# How can I use multiple overlaid map layers (e.g. basemap, labels) in GeoGraphics?

We can use GeoServer to use map tiles from an external service. There are many compatible services:

These services often provide unlabelled background maps, as well as various layers to superimpose on a base map (e.g. labels only, borders only, etc.).

How can we use multiple layers, possibly loaded from multiple different servers, in a way that integrates well with the GeoGraphics functionality and also work with DynamicGeoGraphics?

For example, using the definitions from the above linked answer,

base = GeoGraphics[{Entity["Country", "Hungary"]},
GeoServer -> stamen["watercolor"]]


labels = GeoGraphics[{Entity["Country", "Hungary"]},
GeoServer -> carto["light_only_labels"]]


We could layer these together manually using one of multiple possible ways, e.g.

Overlay[{base, labels}]


But this is not a good solution because it requires multiple GeoGraphics calls that are independent, and does not work with functions like DynamicGeoGraphics.

• Cross-posted at W Community. – Szabolcs Sep 7 '17 at 13:19
• Wikimapia already works this way: it provides semi-transparent tiles for overlaying with Google satellite images. In this answer of mine you can find an example how it is possible to combine them in Mathematica. – Alexey Popkov Sep 13 '17 at 23:07

It's possible to superimpose multiple layers within the same GeoGraphics if the layers are "geoprimitives" for which you can define different geostyles (including opacity and the choice of geoserver). Here is a simple example:

GeoGraphics[{{GeoStyling["StreetMap", Opacity[1],
GeoServer -> "http://tile.stamen.com/toner/1/2/3.png"],
Polygon[Entity["Country", "Hungary"]]}, {GeoStyling["StreetMap",
Opacity[0.2],
GeoServer -> "http://a.tile.openstreetmap.org/1/2/3.png"
], Polygon[Entity["Country", "Hungary"]]}},
GeoBackground -> GeoStyling[Opacity[0.]], ImageSize -> 500]


(Instead of Polygon you can use other geographic primitives like in this post.)

The difficulty of course is to set the right opacities for the layers (when you have to deal with just more than labels like in your trivial example).

You can try the previous example with DynamicGeoGraphics, it does not seem to work, zooming is not possible, the layers are not dynamically updated. And you'll notice that you cannot get rid of the GeoBackground anymore which actually is the only one to update ! Clearly, DynamicGeoGraphics need some more dev ...

Here's a sample application to show MODIS snow cover data in China:

GeoGraphics[{
EdgeForm[Black],
GeoStyling["StreetMap",
GeoServer -> {"https://map1.vis.earthdata.nasa.gov/wmts-webmerc/MODIS_Terra_Snow_Cover/default//GoogleMapsCompatible_Level8/1/3/2.png",
"TileDataType" -> "PNG", "ZoomRange" -> {1, 8}}
],
Polygon[Entity["Country", "China"]]
},
GeoBackground -> GeoStyling["ReliefMap"], ImageSize -> Large
]
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.16560567915439606, "perplexity": 3418.4140850452745}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.3, "absolute_threshold": 20, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-34/segments/1596439735833.83/warc/CC-MAIN-20200803195435-20200803225435-00509.warc.gz"}