Friday, October 8, 2010

Random Feature Selection

I met with a gentleman today who needed to select random streets in Wilmington in order to do a field survey of urban forestry there. Here are the steps we took to do so:

-Use Excel and the RANDBETWEEN function to generate random numbers in a range = total number of features (in this case, streets in Wilmington). Drag this equation down a column = number of features in sample. Once this has been done, save/export (I usually like to use DBF for ArcGIS)

RANDBETWEEN(bottom,top)

Bottom is the smallest integer RANDBETWEEN will return.

Top is the largest integer RANDBETWEEN will return.

- with data added to ArcGIS, use "Frequency" tool to check that no duplicate values were generated

- do a regular one to one join, dropping out all values that don't match. The result will be a random set of features -- in this case, street segments.


Thursday, October 7, 2010

View KML Source from MyMaps

Google MyMaps allows you to export KML by using the "Export to Google Earth" feature. If you copy/paste the URL that this button links to you get a KML, but it is a network reference to the actual KML. If you copy/paste the URL referenced in this KML in your browser, you'll get a warning "{errorText:"Unable to contact server."}". To get past this warning, you must decode the encoded URL reference. That means getting rid of all the "amp;" strings.

For example, change:
http://maps.google.com/maps/ms?ie=UTF8&hl=en&vps=1&jsv=250a&oe=UTF8&msa=0&msid=113097578162956796020.00048fc123b72558b50ff&output=kml

to


and you'll get the actual kml. You do not need to do this within any script or program, since those tend to encode URLs anyway. However, it is very useful for debugging issues with KML.

Friday, October 1, 2010

Geoserver Labeling, Font Changes

Wierd Geoserver Behavior (bug): font changed from Arial to some kind of serif font for no apparent reason. I fixed this by clearing all caches and restarting the Geoserver service. I'm still not sure what caused the issue.

Animal Movement and Home Range Options for ArcGIS

The Animal Movement Extension was written in Avenue, and development stopped many years ago. Therefore, Animal Movement Extension is not available for ArcGIS 9.x or 10.

There are a couple of options if you'd like to move forward with ArcGIS

  • A lot of people using Animal Movement extension migrated to Hawths Tools, to be able to use ArcGIS. Hawths tools offered many of the functions in Animal Movement, though Hawths tools is also now a discontinued project, and will not work with newer versions of ArcGIS (9.2 was the last version it worked with).
  • Hawths tools has been been merged into the Geospatial Modeling Environment, which works with ArcGIS 10. You can download this and find more info at: http://www.spatialecology.com/gme/
  • Home Range Tools for ArcGIS works on ArcGIS 9.x, and is available at http://nhsbig.inhs.uiuc.edu/wes/home_range.html
  • There is a lot of work going on with Agent Based modeling right now. I met with an agent based modeling working group at the ESRI conference. They've developed an extension for ArcGIS based on repast called Agent Analyst: http://www.institute.redlands.edu/agentanalyst/ . I didn't hear about any scenarios involving wildlife movement, buy there is a book coming out, and I would assume those scenarios might be discussed. I'll keep my ear to the ground on this one
  • There are also contributed and native tools and scripts that could be used to perform many of these functions if strung together in the right order
Other Resources

Wednesday, September 29, 2010

Geoserver SLD Polygon Labels Repeat

Fix: had specified larger tile size for earlier debugging. Switch tilesize back to 256 to fix label repeat on polygons.

Tuesday, September 28, 2010

FIX! Geoserver not displaying labels

I've been having an extremely frustrating problem over the last month ... in one word: labeling. My latest labeling challenge, was that Geoserver refused to show labels for many buildings. I tried all kinds of things ... isolating the buildings layer, checking my query order, changing conflicts/overlap options ... pretty much anything I could think of to get labels to display.

Finally, I figured it out! There is an obscured parameter in older ('stable') versions of Geoserver, which was finally exposed through SLD vendorOption in the latest release of Geoserver/Geotools. This parameter MIN_GOODNESS_FIT is used when labeling polygons in particular. Based on MIN_GOODNESS_FIT geotools determines if From geoserver docs:

Geoserver will remove labels if they are a particularly bad fit for the geometry they are labeling.

The label is sampled approximately at every letter. The distance from these points to the polygon is determined and each sample votes based on how close it is to the polygon

so labels are removed if letters are beyond a certain threshold from the polygon. That meant that small buildings (especially ones with longish names) would never be labeled.

However, in Geoserver 2.1 the SLD VendorOption "goodnessOfFit" is exposed

Syntax follows this example:

0.3

the default value is 0.5, so anything lower will allow more lables to be placed.


Issue discussion:



Thursday, September 16, 2010

Geoserver WebTileCache

I was ultimately not able to deal with cutoff labels in Mapnik (or labels not being placed because of tile/overlap issues), so I went with Geoserver for the UD campus map project. The WebTileCache automatically tilecaches all services ... only challenge is to use SLD for styling.