This is the first of four planned posts about how I constructed the range maps for fiddler crabs. This first part (likely the longest) will give the history and background of how these maps were drawn in the first place. The second part will discuss where the maps become problematic when we want to use them as input data for analysis. The third part will present a possible solution to the problem detailed in the second part. The fourth and final part will step back and ask if we’re actually thinking about range maps the wrong way entirely.
1. The Original Maps
In mid-2002 I decided to add maps depicting the distributions of each fiddler crab species to the website. I don’t recall why; possibly I just wanted updated information, possibly there was another motivation. This might be around when I expanded the site beyond its original collection of photos, videos, and references to be a bit more species-information-centric. The maps that ended up on the site were constructed in the roughest way possible.
The base data that went into each map started with the maps from Crane’s 1975 monograph.
Using this as the starting range, I pored through the literature post-1975 (more or less) to look for publications that might have information altering the ranges presented by Crane. Once I’d established an updated range for a species, a background map of the coastline was drawn for the appropriate area using the first version of my spatial software PASSaGE. This map was imported into a graphics program (Photoshop? MS Paint?) and the range was hand drawn with a transparent brush and saved as a raster image (GIF of all things) for display on the site. Not precisely high-tech, but it got the job done.
One obvious problem with this approach was updating a map often required redrawing it from scratch, particularly if the range needed to be reduced rather than expanded. Not the most efficient approach and not the best quality.
2. The Interactive Maps
At some point between 2011 and 2013, the entire website was rebuilt from the ground up; this is when the site was transitioned from hand-coded to dynamically created from a data back-end. How to handle the range maps was an interesting question, and after some exploration Google Maps seemed to be a good solution. By creating a custom KML layer for each species, I could use the Google Maps API to insert an interactive map into the webpages.
The challenge was how best to create the KML layers with the species ranges. The solution I came up with had a couple of different parts. One key element was to take advantage of the fact that (adult) fiddler crabs are essentially restricted to marine coastlines (they go a little bit inland into river mouths and estuaries and the like, but on the global scale this is still within the margin of error of the “coast”). Juveniles presumably get a bit more into the ocean, but even there the limited data suggests most of them seem to stick close to the shore.
Thus, a set of coastline data can provide the entire framework on which to build a fiddler crab range: basically, any given piece of coastline can either be in the range or out of the range, and you don’t have to particularly worry about any space in between coastlines (whether land or open ocean). To create these, I imported a full set of world country borders from within Google Earth (Google Earth made it easy to quickly display, check, and update distributions without fighting with the vagaries of the online Google Maps API). For each country whose coastline had fiddler crabs, I exported the individual country to a KML file, then manually removed the parts of the boundaries that represented interior land borders, leaving only coastlines. Countries with borders that included multiple major oceanic regions were split into their constituent parts (e.g., an Atlantic Panama coast and a Pacific Panama coast). All of these coast outlines were re-imported into Google Earth. For each species it was then just a matter of copying the appropriate country borders into a new folder to represent that species; when only part of a country was in the species range, a copy of that country’s coastline was again exported, manually trimmed to the correct range, then re-imported. While seemingly a lot of up front work, for most species it became a fairly quick and easy method to produce the ranges. Each species had its own folder within Google Earth and the whole set was exported as a single KML file. I then wrote a program to extract all of the individual maps from this file, standardizing certain style elements, and exporting each one to its own individual file for integrating with the Google Maps API on the website. This also allowed the creation of the map which overlaps all of the species ranges with high transparency to get a worldwide view of species density.
Updating or editing the maps, while still a bit of work, was substantially easier than with the original ones since it only required changing a subset of the coastline data, rather than redrawing an entire map by hand.
Interestingly, a few people complained about the new maps. As rough as they were, the old ones displayed the ranges in a fairly simple cartoon form which is lost with the more complicated Google Map backdrop; also, the new images are not easily exportable for use in another format (beyond doing a screen grab, as I had to do to display the above figure).
3. The New Static Maps
Recently, as part of some potential and planned updates to the site, I came to the realization that the inability to automatically export the maps to an image for use outside a webpage had become somewhat problematic. After a lot of time spent trying (and failing) to come up with ways to automatically export the layered Google Map, it finally occurred to me that the obvious solution was to back away from the Google Map approach entirely for non-web-based use. In fact, part of the solution was to go back to the beginning. As mentioned above, I’ve written code in the past that can draw a background map given a set of lines or polygons describing coastal outlines (data readily available from a number of online sources). And although it was never part of the original plan, the KML file that is being used to add the Google Map layers has all of the boundary data for the ranges in an already parsable format. Combining these into the site creation code with a drawing module that could export directly to a file suddenly allows us to automatically draw higher quality cartoon maps, much like the site originally had, but automated from the code rather than hand painted. (1) Use the world map data to draw a nice representation of key coastlines. (2) Draw the range data from the KML file on top of this in a different color and with a slightly thicker line to help make it stand out. (3) Export as a vector file format (SVG) rather than raster file to allow scalability for high quality figures. I still use the Google Maps and KML layers on the website for interactivity, but these new maps can be seen and downloaded by clicking on the link directly below the corresponding Google map (the link can be seen in the previous figure).
On these new maps I decided to use a background map with country boundaries to help make the ranges more obvious, and filled in the land areas to make the maps clearer for species with more limited ranges, but unlike with the original maps, these decisions can be quickly changed and the maps redrawn with minimal effort since they are created programmatically. The range data itself is identical to that from the Google Maps.
For display purposes outside of webpages, these newer maps are quite nice. But all is not perfect if we actually start thinking about using these ranges as data rather than just visual guides. To be continued in part two…