Skip to main content Link Search Menu Expand Document (external link)

Create Maps

Use gol query with option -f=map to display query results on a Leaflet-based map.

  • Use --tags to specify the tags that are displayed when the user hovers over a feature.

Formatting options:

-f:attributionAttribution text at the bottom of the map
-f:basemapTile server URL for base map
-f:colorColor of map markers
-f:linkURL to navigate when user clicks on a feature

If you are using map tiles provided by a third party, be sure to follow their tile usage policy and provide proper attribution (For the OpenStreetMap default style, please see (Policy for OSM Tiles).

Example

A map displaying all museums in London, using the Thunderforest Atlas style (proprietary third-party style, API key and attribution required). The name and opening hours are displayed when the user hovers the cursor over a museum feature, and clicking it will show the feature on OpenStreetMap’s Humanitarian layer.

gol query world -a=london.poly na[tourism=museum] -f=map 
  -t=name,opening_hours
  -f:attribution="Maps © <a href='*'>Thunderforest</a>, Data © OpenStreetMap contributors"
  -f:basemap="https://tile.thunderforest.com/atlas/{z}/{x}/{y}.png?apikey=<YOUR-KEY-HERE>"
  -f:link=https://www.openstreetmap.org/$type/$id#layers=H 
  > london-museums.html 

*) links omitted for brevity

Formatting Options

-f:attribution=<TEXT>

The attribution text to display at the bottom of the map. Can be plain text or HTML, and must be enclosed in double quotes if it contains spaces, pspecial characters or HTML tags.

-f:basemap=<URL>

The URL to use for the base map.

-f:color=<COLOR>

The color of map markers: a named color (red, green, etc.) or an HTML color value (e.g. #FF8835).

URL to navigate when user clicks on a map feature (defaults to the main OSM website).

  • Use the $type and $id placeholders ($t and $T for type as a single letter) 0.2

  • Use -f:link=none to disable links