4

Speaking of tilesource urls such as

http://{s}.tile.stamen.com/watercolor/{z}/{x}/{y}.png

is there any technical documentation or canonical reference for the curly braces syntax?

I'd specifically like to know what other things can be used in curly braces, and in which places, and how they work.

4

You can have a look at the OSM wiki about Slippy_map_tilenames ...

There are some URL definitions for different OSM based tile services. Thus you can see the meaning of x y z values.

Also there are some mathematical formulas how to calculate tile numbers from lat/lon I think.

3

Short answer:

Nope, it's just a convention.

Long answer:

They're called 'URL templates', and are related to the template processing functionality found in many programming languages. As of ES6 they're also supported natively by JavaScript, where they're sometimes known as template literals.

While there is a standard for URL templating broadly, there isn't really any canonical reference for the values used in mapping libraries – it's just a convention used by tileset developers, and the various templating schemes are supported at the discretion of mapping libraries' developers.

There are many which are more common – besides {x}{y}{z}, you might find:

{s} – alternate redundant servers used to improve parallel tile serving, eg [a,b,c,d].tile.stamen.com, etc

{r} - alternate resolutions, as found in the wikimedia tile servers, which offer different scales of their tiles for screens with various resolutions, including 1.3, 1.5, 2, 2.6, and 3: https://maps.wikimedia.org/osm-intl/0/0/0{r}.png

But libraries may also implement their own – Mapbox uses a bunch of custom placeholder strings to support custom behavior including {quadkey}, {ratio}, and {prefix}: https://docs.mapbox.com/ios/api/maps/4.7.0/tile-url-templates.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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