D3 Tips and Tricks v4

Thursday, 13 February 2014

Using the MapQuest Open Aerial tile server with leafet.js

The following post is a portion of the Leaflet Tips and Tricks book which is free to download. To use this post in context, consider it with the others in this blog or just download the the book as a pdf / epub or mobi .

MapQuest Open Aerial

The ‘MapQuest Open Aerial’ tiles are a collection of aerial imagery that covers the globe at varying levels of detail depending on location. The imagery originated from NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency.
The tiles are distributed by the good folks at MapQuest who also distribute a set of OSM tiles called MapQuest-OSM. Global coverage is provided at zoom levels 0-11. Zoom Levels 12+ are provided only in the United States (lower 48).

URL Template


Usage policy

There are some generalised direction (and lots of other good stuff) on the MapQuest-OSM Tiles + MapQuest Open Aerial Tiles page. They are all very reasonable and sensible and are concerned with making sure that the load on the service is not unduly onerous. There is also a link to their official ‘Terms of use’ page which is a more formal wording of their common sense instructions.


If using the MapQuest Open Aerial Tiles, attribution is required to read; “Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency” (which is quite long and on the example picture used below there is some serious word-wrapping). Additionally they ask that “Tiles Courtesy of MapQuest” be placed on the map along with their logo and a link from the ‘MapQuest’ portion that goes to ‘http://www.mapquest.com/’.

Usage example

This usage example is slightly more complex in that it involves a slightly different approach to including the subdomains. Leaflet will normally operate with subdomains of the form ab and c, but in this example we find otile1otile2otile3 and otile4. To accommodate this the otile portion is included in the URL and the variable parts of the subdomain are declared in a separate option called subdomains.
mapquestLink = '<a href="http://www.mapquest.com//">MapQuest</a>';
mapquestPic = '<img src="http://developer.mapquest.com/content/osm/mq_logo.png\
    'http://otile{s}.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', {
    attribution: 'Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agric\
ulture, Farm Service Agency. Tiles courtesy of '+mapquestLink+mapquestPic,
    maxZoom: 18,
    subdomains: '1234',
MapQuest Open Aerial map

More Examples

I will post separate examples of the usage of different tile servers as separate posts. Or you can find them all in Leaflet Tips and Tricks.

The description above (and heaps of other stuff) is in the Leaflet Tips and Tricks book that can be downloaded for free (or donate if you really want to :-)).

No comments:

Post a Comment