Using map tiles to make a high resolution map for publication

Using map tiles to make a high resolution map for publication

To make a high resolution GBIF map, first retrieve the base map tiles. This example will use WGS 84 projection (code 4326), show the whole world at zoom level 0 (tiles 0/0/0 and 0/1/0) and use gbif-classic style. A list of projections and styles is on tile.gbif.org.

Note the @4x, this retrieves the highest available resolution.

Then download the occurrence density tiles. The projection and tile codes must match. The style is classic.poly, with other parameters controlling the hexagons/squares/points and their size (bin=hex&hexPerTile=70) and the search filter (taxonKey=2670513, i.e. this moss).

Join and overlay the tiles in a graphics program. This example uses the command-line tool ImageMagick, but any graphics editor capable of perfectly aligning the images will work:

      # Retrieve the base map layer
      curl -o base-west.png 'https://tile.gbif.org/4326/omt/0/0/0@4x.png?style=gbif-classic&srs=EPSG:4326'
      curl -o base-east.png 'https://tile.gbif.org/4326/omt/0/1/0@4x.png?style=gbif-classic&srs=EPSG:4326'
      # Retrieve the occurrence density layer
      curl -o occ-west.png 'https://api.gbif.org/v2/map/occurrence/density/0/0/0@4x.png?style=classic.poly&bin=hex&hexPerTile=70&taxonKey=2670513&srs=EPSG:4326'
      curl -o occ-east.png 'https://api.gbif.org/v2/map/occurrence/density/0/1/0@4x.png?style=classic.poly&bin=hex&hexPerTile=70&taxonKey=2670513&srs=EPSG:4326'

      # Join the western and eastern hemispheres together
      montage base-west.png base-east.png -geometry +0+0 -tile 2x1 base.png
      montage occ-west.png occ-east.png -geometry +0+0 -tile 2x1 -background transparent occ.png

      # Overlay the occurrence density tile onto the base map tile
      convert base.png occ.png -gravity center -composite combined.png
    

For a web page, the whole operation can be done with HTML and some styling — although cropping the view would be more complicated. View the source of this page to see the code.