Map Views
Maps are useful for communicating the distribution of data collected in labs. Sparrow has several map views available by default (see WiscAr example). These include a simple map with cultural information, a map with satellite views and cultural information, a topographic map, and a geological map that draws on Macrostrat. The non-geological maps are built using Mapbox.
Custom mapbox styles
In Sparrow, you can add custom Mapbox styles to visualize your sample distributions. These are added in the Sparrow/frontend/plugins/MapStyle/index.ts
file. A custom name (e.g. "Topographic Map") adds the style to the dropdown menu on the Map tab (as pictured above). You also add the style URL to this file. The code for a single map style is shown below.
{
name: "Topographic Map",
style: "mapbox://style/...",
}
To find your style URL, look at a style in Mapbox Studio (see screenshot below). You can learn more about making new styles in the Mapbox tutorials and documentation.
A Mapbox API token for your lab needs to be created and added to your configuration files for your instance of Sparrow that is publically available. You can find this information in your Mapbox account. The most recent free version allows 50,000 views a month.
This is added to the sparrow-config.sh
file as noted below. This will enable your public Sparrow instance to render maps from Mapbox.
export MAPBOX_API_TOKEN="yourlongtoken"
Customizing Geological Maps
Editing static map style for samples
If you want to customize your static map style for the static sample location map or the map that informs sample location updating, you adjust two different files. In frontend/src/components
the static-map.ts
can be edited for a custom map style.