LayeredGeoGraphics -- An awesome way to build multi-layered custom maps!

The Wolfram Language comes with lots of great functions, but one of my all-time favorites is GeoGraphics and all its GeoSiblings. Here is a simple example of how easy it is to create a map in the Wolfram Language:

GeoGraphics[Interpreter["City"]["nyc"]]

And you can use some built-in ‘backgrounds’ as well, for example:

GeoGraphics[Interpreter["City"]["washington dc"], GeoBackground -> "ContourMap"]

A perhaps lesser known option, but very useful one is the GeoServer option, which lets you point to any tilemap server:

GeoGraphics[Interpreter["City"]["rome, italy"], GeoServer -> "http://b.tile.openstreetmap.org/`1`/`2`/`3`.png"]

This is a very powerful feature, because there are many many tilemap servers in existence. Many are free for personal use and others require some sort of subscription with a key to unlock the tilemap server.

Finding all of them is a hassle, so I am making a GeoService function available in my Prototype paclet on GitHub. This is a paclet which provides a number of half-baked (and sometimes fully baked!) functions that are not (or not yet) in the core Wolfram Language. Here is how you get this paclet (and the functions described in this post):

PacletInstall[ "https://github.com/arnoudbuzing/prototypes/releases/download/v0.2.7/Prototypes-0.2.7.paclet"]

(You may need to Quit and restart the Wolfram Language after this)

The GeoService function is a collection of a number of publicly documented tilemap servers:

GeoService["Properties"]

Here is the output:

{"OpenStreetMap", {"OpenStreetMap", "France"}, {"OpenStreetMap", "France", "Humanitarian"}, "WikiMedia", "HikeAndBike", {"WaymarkedTrails", "Hiking"}, {"WaymarkedTrails", "Cycling"}, "SkiMap", "HillShading", {"OpenCycleMap",  "Cycle"}, {"OpenCycleMap", "Transport"}, {"Mapnik", "Grayscale"}, {"Mapnik", "LabelFree"}, {"Stamen",  "Toner"}, {"Stamen", "Watercolor"}, {"ThunderForest", "Landscape"}, {"ThunderForest", "Outdoors"}, "Opnvkarte", "OpenPtMap", {"Carto", "Dark"}, {"Carto", "Light"}, "OpenSeaMap", {"OpenRailwayMap",  "Standard"}, {"OpenRailwayMap", "MaxSpeed"}, {"OpenRailwayMap", "Signals"}, {"ArcGIS", "UnitedStatesTopographical"}}

Already immediately this gives you a whole new set of maps you can make. Here are some examples:

GeoGraphics[Interpreter["City"]["athens, greece"], GeoServer -> GeoService[{"Mapnik", "LabelFree"}]]

GeoGraphics[Interpreter["City"]["cairo, egypt"], GeoServer -> GeoService["WikiMedia"]]

But all these maps are single layered, whereas several tilemap servers provide transparent layers for some “theme”. For example here is a layer which contains only hiking trails in a part of the Yorkshire Dales:

GeoGraphics[Interpreter["City"]["malham, united kingdom"], GeoServer -> GeoService[{"WaymarkedTrails", "Hiking"}]]

This sort of layer is most useful when it is combined with another (non-transparent background) layer. One way to achieve this is to use the Overlay functions which can display one Wolfram Language expression on top of another:

Overlay[{"XXXX  ", "  OOOO"}]

gg-07.png

In the “Prototype” paclet (described above) I defined a LayeredGeoGraphics function which uses Overlay to stack multiple layers. Here is an example which shows hiking trails against a grayscale Mapnik layer:

LayeredGeoGraphics[
  Interpreter["City"]["malham, united kingdom"], 
  {{"Mapnik", "Grayscale"}, {"WaymarkedTrails", "Hiking"}}, 
  GeoRange -> Quantity[1, "Miles"]]

And of course you can stack more than two layers. Here is an example of a label-free background layer from Mapnik, with a hill-shading layer and a hiking trail layer on top of it (The hill-shading provides the “depth” look and feel):

LayeredGeoGraphics[ Interpreter["City"]["malham, united kingdom"], {{"Mapnik", "LabelFree"}, "HillShading", {"WaymarkedTrails", "Hiking"}}, GeoRange -> Quantity[1, "Miles"]]

The possibilities are endless! If you find additional tilemap servers please feel free to add them here as a comment, or make a pull request in my Prototypes github repo. More layers = more possibilities!

21 Likes

Thank you for posting. This is very useful!

Thanks,

Marco

1 Like

Glad you like it!

It is fantastic. I have been playing with tile servers like here, based on openstreetmap, and here.

You paclet will keep me busy for a bit…

Thanks again,

Marco

Thanks for sharing!

You could post an answer here:

2 Likes

If this is possible, it’d be super to see some historical geo-referenced maps supported as well. For example, I think this CC-BY historical (1920-1940s) Ordnance Survey map of the UK from the National Library of Scotland should be compatible as it’s shared via the Map Tile Service standard: https://maps.nls.uk/projects/api/index.html

2015-11-02_10-07-11.png

  • Congratulations! This post is now a Staff Pick as distinguished by a badge on your profile! Thank you, keep it coming!

If you find additional tilemap servers please feel free to add them here

There is Wikimapia. I describe how it can be used in the following post:

Note also that there are also Yandex Maps and Kosmosnimki.ru tile servers which use ellipsoidal Mercator projection currently unsupported by Mathematica.