Get more for less with 512 pixel tiles

Starting today, Mapzen basemaps require fewer Mapzen Flex requests (saving you money) and feature better label placement thanks to new 512 pixel vector and terrain tiles, and new versions of Tangram JS and ES.

We are also introducing buffered terrain tiles in both 260 and 516 tile sizes to enable new 3D and analytical applications.

Basemaps

Mapzen basemaps display and style data from the Mapzen vector and terrain tile services. Switching to 512 pixel size network requests can reduce overall latency and improve label placements in Tangram compared to 256 pixel tiles. Best of all, reduced network requests can also lower your Mapzen Flex bill!

The following Mapzen basemap versions introduce 512 pixel tiles:

  • Bubble Wrap: 8.0.0
  • Cinnabar: 8.0.0
  • Refill: 9.0.0
  • Tron: 5.0.0
  • Walkabout: 6.0.0

These updates (along with other new features like Mapzen icon library support, label steps on all styles, and Zinc graduating to a Refill theme) are immediately available in Mapzen.js and via the mapzen.com/carto endpoints.

Tangram added 512 pixel tile support in JS v0.13 and the ES 0.7 releases. Android and iOS SDK support for updated basemap styles and 512 pixel tiles is coming soon.

512 pixel vector tiles

Historically, the first web slippy maps were based on 256 pixel-sized raster tiles. While vector tiles don’t store pixels, we still use the same handy z/x/y addressing scheme, and so our v1.0 service launched with 256 pixel “logical” tiles last year.

Larger 512 pixel-sized tiles have grown more common in the industry and offer many benefits:

  • Fewer tiles, fewer network requests: a single 512 request is equivalent to four 256 requests at all zooms, and a single zoom 15 request includes all data above zoom 16
  • Better labels: map rendering tools like Tangram and MapboxGL get more room to place labels
  • Smaller overall file sizes: a 512 tile compresses more efficiently than four 256 tiles
  • Offline: Fewer 512 tiles are needed to cover the same geographic area, requiring less less disk space

Mapzen Flex charges for API requests irrespective of tile size. A single 512 request is 25% the price of the four 256 requests for the equivalent “map view” of the same area, which means a lower Flex bill in most cases!

The new API endpoint pattern for vector tiles is:

https://tile.mapzen.com/mapzen/vector/v1/{tilesize}/{layers}/{z}/{x}/{y}.{format}?api_key=your-mapzen-api-key

Note that 512 is opt-in. {tilesize}/ is not required in the path and existing API requests will continue to function as before, returning the default size of 256.

The suggested max {z} value for 512 pixel tiles is zoom 15. Like 256 pixel tiles, requesting {z} coordinates up to 20 will return a smaller geographic area, but the tile will not include any additional data already in the zoom 15 tile. (In practice, requesting 512 tiles up to zoom 16 can improve Tangram performance.)

To use the tiles in Tangram, specifying a tile_size of 512 in the source block is strongly suggested, otherwise content will stretch and appear less detailed than intended.

Example Tangram YAML:

sources:
    mapzen:
        type: MVT
        url:  https://tile.mapzen.com/mapzen/vector/v1/512/all/{z}/{x}/{y}.mvt
        url_params:
            api_key: your-mapzen-api-key
        tile_size: 512
        max_zoom: 16

We’ve been beta-testing 512 pixel vector tiles since February, starting with the v1.1 release, which grouped neighbouring 2x2 chunks of tiles together for processing. (We call that a “metatile”, although that name is often used to mean many different things!) This makes much better use of the map database by querying for a larger area and chopping the result up to make the original four tiles. We also reduce storage costs by keeping all four tiles together as a ZIP file that Tapalcatl unpacks. This means a quicker API response, because unlike the database, we run Tapalcatl in many datacentres all over the world.

Terrain tiles

We announced the Terrain Tiles service and the public dataset just over one year ago in cooperation with the Amazon Web Services (AWS) team. The Terrain Tiles public dataset offers digital elevation models (DEMs) for the entire Earth, with varying resolutions of data sourced from open data providers from around the world. (We use the terrain data in both Walkabout and Tron to draw hillshading.)

To support larger 512 pixel vector tiles we’ve added a new microservice we call Zaloa to stitch four 256 pixel tiles into one large 512 pixel tile on-the-fly, and introduce two new buffered sizes.

Both Terrarium and Normal formats now support tile sizes of 256 and 512 for basic map display, and buffered sizes of 260 and 516 pixels useful for 3D and analytical applications. When not provided, the size defaults to 256.

https://tile.mapzen.com/mapzen/terrain/v1/{tilesize}/{format}/{z}/{x}/{y}.{extension}?api_key=your-mapzen-api-key

Besides the 512 pixel tile size benefits terrain tiles enjoy with vector tiles, new buffered 260 and 516 pixel sized tiles offer several benefits:

  • Fewer network requests: The 2 pixel edge buffers reduce network requests from 9 to 1, as sampling neighboring tiles is no longer necessary. A single 516 request is equivalent to four 260 requests.
  • 3D geometry construction: The buffer provides enough height values in the overlap to calculate 3D elevation meshes without loading neighboring tiles.
  • Enables professional shading for 3D: The 2nd pixel of buffer enables custom normals (slopes) to be calculated for the 1st pixel of the terrarium buffer without loading neighboring tiles.

The maximum {z} value for 512 pixel tiles is zoom 14. Requesting {z} coordinates past that will result in a 404 error.

Example Tangram YAML:

sources:
    mapzen:
        type: MVT
        url:  https://tile.mapzen.com/mapzen/terrain/v1/512/normal/{z}/{x}/{y}.png
        url_params:
            api_key: your-mapzen-api-key
        tile_size: 512
        max_zoom: 14

Access to Mapzen’s terrain tiles continue to be free (with an API key) – they are not billed in Mapzen Flex.

Read the docs

Check out the full story in the project release notes:

Feedback

We’re excited to see what you build and would love to hear feedback on the cartography or tiles. Please direct comments to Nathaniel Vaughn Kelso, our Chief Cartographer, at hello@mapzen.com!

Photo credit via Cooper Hewitt, Tile; Gift of Florence Barnes; 1981-56-52.