Using the GeoServer option, it is possible to load map tiles from external services.

Which services are compatible with GeoServer? How can I find such services? Does GeoServer follow a standard that has a name that I can google for?

The documentation shows a few examples:

GeoGraphics[{Entity["AdministrativeDivision", {"California", "UnitedStates"}]}, 
   GeoServer -> "http://a.tile.openstreetmap.org/`1`/`2`/`3`.png"

Mathematica graphics


3 Answers 3


Mapbox works. It requires an API key which can be retrieved for free, for information about pricing read this.

Mapbox has many beautiful map styles, and also the ability for you to create your own map styles or modify existing ones with their browser based tool.

Here is a list of default styles that everyone has access to:

styles = {"streets", "light", "dark", "satellite", 
   "streets-satellite", "wheatpaste", "streets-basic", "comic", 
   "outdoors", "run-bike-hike", "pencil", "pirates", "emerald", 

Here is a template for using Mapbox with GeoGraphics:

token = (* your API key here *);
style = "outdoors";
st[style_] := StringTemplate["https://api.mapbox.com/v4/mapbox." <> style <> "/``/``/``.png?access_token=" <> token];

 GeoRange -> Entity["City", {"Goteborg", "VastraGotaland", "Sweden"}],
 GeoServer -> {st[style], "ZoomRange" -> {1, 22}}

Mathematica graphics

Here is an example using the "pirates" style:

Mathematica graphics

And another one, also depicting Gothenburg, using the "pencil" style:

Mathematica graphics

  • $\begingroup$ Could you please elaborate on the {st[style], "ZoomRange" -> {1, 22}} bit? How did you know to use "ZoomRange" and are there other options that can be specified? I've been searching around and as far as I can tell the x, y, and zoom are supposed to be hardcoded into the URL right? For example Mapbox's documentation has the example https://api.mapbox.com/v4/mapbox.satellite/1/0/[email protected]? where they specify zoom=1, x=0, y=0 in the URL... $\endgroup$ Oct 21, 2019 at 21:49

The keywords to search for are "tile server" and "XYZ URL". I was able to find several services compatible with this format.

There is a list, complete with previews here:

(Found through GIS.SE)

The {x}, {y} and {z} placeholders in the URL correspond to `1`, `2` and `3` in Mathematica.

MapBox is another great source for base maps, as shown by @C.E. in his answer.

Here are a few examples that do not require API keys:

From https://basemap.nationalmap.gov/,

USGS[map :"HydroCached" | "ImageryOnly" | "ImageryTopo" |"ShadedReliefOnly" | "Topo"] :=
 "https://basemap.nationalmap.gov/arcgis/rest/services/USGS" <> map <> "/MapServer/tile/`1`/`3`/`2`"

From https://carto.com/location-data-services/basemaps/,

carto[style : "light_all" | "dark_all" | "light_nolabels" | "light_only_labels" |"dark_nolabels" | "dark_only_labels"] :=
 "https://cartodb-basemaps-1.global.ssl.fastly.net/" <> style <> "/`1`/`2`/`3`.png"

From http://maps.stamen.com/,

stamenBase[style_, format_] := "http://tile.stamen.com/" <> style <> "/`1`/`2`/`3`." <> format
stamen[style : "toner"] := stamenBase[style, "png"]
stamen[style : "watercolor" | "terrain"] := stamenBase[style, "jpg"]


GeoGraphics[Entity["AdministrativeDivision", {"California", "UnitedStates"}], 
   GeoServer -> #] & /@ {USGS["Topo"], carto["light_all"], stamen["terrain"]}

enter image description here

These are just quick and dirty examples. In some cases it may be beneficial or necessary to set the "Tileset" suboption of GeoServer (see under Details in doc page).

Tile servers can also be used with the interactive DynamicGeoGraphics:

DynamicGeoGraphics[Entity["City", {"Lyon", "RhoneAlpes", "France"}], 
 GeoServer -> stamen["toner"]]

enter image description here

  • $\begingroup$ China hard to use those serve. How to make this map be a mma server? $\endgroup$
    – yode
    Oct 18, 2017 at 19:08
  • $\begingroup$ @yode it won't be easy. The first though would be to use "http://api.map.baidu.com/staticimage?center=2,3&width=300&height=300&zoom=1" but unfortunately Baidu seems to use a different tile spec than the others and also Baidu uses a different coordinate system $\endgroup$
    – b3m2a1
    Apr 18, 2018 at 1:36
  • $\begingroup$ @b3m2a1 I believe that in China, all mapping services must use a certain standard (Chinese) coordinate system by law. This coordinate system differs from what is commonly used by web mapping services, leading to a misalignment with some services (e.g. google map data vs google satellite data). en.wikipedia.org/wiki/… $\endgroup$
    – Szabolcs
    Apr 18, 2018 at 10:12

This specific usage in the documentation confused me momentarily as there is a server for serving mapping features called specifically GeoServer.

However, I think in this usage they mean any kind of server that can provide GIS data.

On the documentation page they specify what the remote server must accept as a request string.

The URL template for tile download uses the XYZ protocol and must be given as a string "http://…/`1`/`2`/`3`.png" or as StringTemplate["http://…/`1`/`2`/`3`.png"]...

This URI is in the Tile Map Service (TMS/WTMS) specification for serving raster data from a server. Most tile servers accept TMS specification as it is standard created by the Open Geospatial Consortium, an organization created to help standardise GIS interoperability.

In the example you provide, they are accessing OpenStreetMaps' own tile server to provide tiles for the slippymap. If you didn't specify the server the map service would use the default values, which appear to be Wolfram's own servers.

  • $\begingroup$ This seems to suggest that XYZ and TMS are different things (but I don't know much about GIS stuff). $\endgroup$
    – Szabolcs
    Sep 7, 2017 at 20:02
  • $\begingroup$ The TMS, I believe came out of the XYZ schema, and wikipedia seems to supports my recollection. TilesetOrientation option in GeoServer accounts for the Y axis reversal between the XYZ and TMS specification. In practice, I have not experienced an issue between the two. $\endgroup$
    – RomaH
    Sep 7, 2017 at 20:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.