Home

Awesome

XYZ Tile Cache Primer

<p align="center"><img src=".github/xyz.png" width="384" alt="XYZ Logo"></p> <p align="center"> <a href="https://github.com/dechristopher/xyz/actions"><img alt="XYZ Build Status" src="https://github.com/dechristopher/xyz/workflows/Build/badge.svg"></a> <a href="https://goreportcard.com/report/github.com/dechristopher/xyz"><img alt="XYZ Go Report Card" src="https://goreportcard.com/badge/github.com/dechristopher/xyz"></a> </p>

About

This tool, given the URL to an XYZ tile caching proxy, will procedurally generate and execute requests for every tile at every zoom level up to the maximum zoom level specified. Concurrency is optional and configurable. Headers for authentication or user agent spoofing can be specified using command line flags.

Usage

The design of XYZ is as simple as possible. It will not have a rich feature set primarily because the scope of the problem it solves isn't very wide. Here is a brief overview on how to use the tool in its entirety:

Flags

  --url    Templated cache URL to prime. Ex: tile.company.com/{x}/{y}/{z}.png
  --zoom   Max zoom depth to prime to. Usually in the range of 0-18 but can go deeper.
  --cc     Maximum request concurrency. Defaults to 4 simultaneous requests.
             Take care not to exceed the rate limits of your tile provider!
  --header Add headers to all requests. Usage `--header name:value`.
  --help   Shows this help menu.

Examples

  xyz --url tile.company.com/{x}/{y}/{z}.png
  xyz --url tile.company.com/{x}/{y}/{z}.png --zoom 8
  xyz --url tile.company.com/{x}/{y}/{z}.png --zoom 8 --cc 16
  xyz --url tile.company.com/{x}/{y}/{z}.png --header X-Auth-Token:8675309abcd

Roadmap

Releases

To get a copy of XYZ, either visit the releases page or clone the repo and compile it yourself.

The current Go version requirement to build is 1.14+

Map Tiles Overview

Splitting the world into square tiles is a simple way to distribute geographic information and metadata to devices. From raster data representing illustrated or generated cartography to vector data representing infrastructure and other arbitrary geometries, tiles optimize the time and space necessary to gather pieces of grographic information. This allows us to quickly illustrate a geographic region and its associated attributes.

Zoom Level

The zoom parameter is an integer between 0 (zoomed out) and 18 (zoomed in). 18 is normally the maximum, but some tile servers might go beyond that. A tile at a given zoom level will split into four equally sized tiles at the next zoom level.

Level# TilesTile width (° of longitudes)m / pixel (on Equator)~ Scale(on screen)Examples of areas to represent
01360156,4121:500mwhole world
1418078,2061:250m
2169039,1031:150msubcontinental area
3644519,5511:70mlargest country
425622.59,7761:35m
51,02411.254,8881:15mlarge African country
64,0965.6252,4441:10mlarge European country
716,3842.8131,2221:4msmall country, US state
865,5361.406610.9841:2m
9262,1440.703305.4921:1mwide area, large metropolitan area
101,048,5760.352152.7461:500kmetropolitan area
114,194,3040.17676.3731:250kcity
1216,777,2160.08838.1871:150ktown, or city district
1367,108,8640.04419.0931:70kvillage, or suburb
14268,435,4560.0229.5471:35k
151,073,741,8240.0114.7731:15ksmall road
164,294,967,2960.0052.3871:8000street
1717,179,869,1840.0031.1931:4000block, park, addresses
1868,719,476,7360.0010.5961:2000some buildings, trees
19274,877,906,9440.00050.2981:1000local highway and crossing details
201,099,511,627,7760.000250.1491:500A mid-sized building

Ref: https://wiki.openstreetmap.org/wiki/Zoom_levels