Skip to content

Commit e2ca30b

Browse files
authored
Merge pull request #1288 from tilezen/nvkelso/docs-512px-max-zoom-coords-status
[docs] add 512px tile size, max zoom, tile coords, http status codes
2 parents 58fefd1 + 3efe4f0 commit e2ca30b

File tree

3 files changed

+107
-3
lines changed

3 files changed

+107
-3
lines changed

docs/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ This repository contains documentation for Mapzen's Vector Tile service.
55
* [index.md](index.md) - This is where all the good stuff is.
66
* [use-service.md](use-service.md) - Use the vector tile service, layers, and tile formats.
77
* [api-keys-and-rate-limits.md](api-keys-and-rate-limits.md) - Don't ruin a good thing.
8-
* [display-tiles.md](display-tiles.md) - Display vector tiles in a map in Tangram, MapboxGL, D3, and other frameworks.
8+
* [display-tiles.md](display-tiles.md) - Display vector tiles in a map in Tangram, MapboxGL, D3, and other frameworks.
99
* [layers.md](layers.md) - Layers in the vector tile service detailed incuding available `kind` values and other tags.
1010
* [data-sources.md](data-sources.md) - Where does Mapzen's data come from?
11-
* [attribution.md](attribution.md) - Giving credit where credit is due, and the data licence requires it.
11+
* [http-status-codes.md](http-status-codes.md) - HTTP status codes.
12+
* [attribution.md](attribution.md) - Giving credit where credit is due, and the data licence requires it.
1213

1314
## Contributing
1415

docs/http-status-codes.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# HTTP status codes
2+
3+
The following is a list of HTTP status error code conditions that may occur for a particular request.
4+
5+
In general, the service follows the [HTTP specification](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes). That is to say that `5xx` returns are generally ephemeral server problems that should be resolved shortly or are the result of a bug. `4xx` returns are used to mark requests that cannot be carried out, generally due to bad input in the request or problems with the underlying data. `3xx` returns are used to mark requests that are content redirects . A `2xx` return is expected when there is a successful `tile` response for a given tile coordinate, list of layers, and file format.
6+
7+
The following status codes are returned from the vector tile service:
8+
9+
- `200 OK`: The request has succeeded.
10+
- `304 Not Modified`: Tile hasn't changed since the last time it was requested and there is no need to retransmit the resource since the client still has a previously-downloaded copy.
11+
- `400 Bad Request`: An input parameter was invalid. An error message is included in the response body with more details.
12+
- `403 Forbidden`: The URL is invalid or the path is no longer valid.
13+
- `404 Not Found`: The URL is invalid or the path is no longer valid.
14+
- `429 Too Many Requests`: Rate limiting, refer to Mapzen's [rate limits](https://mapzen.com/documentation/overview/rate-limits/) documentation.
15+
- `500 Internal Server Error`: Generic fatal error.
16+
- `502 Bad Gateway`: Connection was lost to the tileserver cluster.
17+
18+
In the `200 OK` case above, the `tile` response body will be valid GeoJSON, TopoJSON, or MVT document. In the other cases a text file will be returned with a message and the response header will specify the HTML status code.

docs/use-service.md

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,28 @@ Here’s a sample tile in GeoJSON:
2828
https://tile.mapzen.com/mapzen/vector/v1/all/16/19293/24641.json?api_key=your-mapzen-api-key
2929
```
3030

31+
## Specify z, x, and y tile coordinates
32+
33+
Tiled geographic data enables fast fetching and display of "[slippy maps](https://en.wikipedia.org/wiki/Tiled_web_map)".
34+
35+
Tiling is the process of cutting raw map data from latitude and longitude geographic coordinates ([EPSG:4329](http://spatialreference.org/ref/epsg/4329/)) into a smaller data files using a file naming scheme based on zoom, x, and y in the Web Mercator ([EPSG:3857](http://spatialreference.org/ref/sr-org/6864/)) projection.
36+
37+
### Tile coordinate components
38+
39+
- `{z}` **zoom** ranges from 0 to 20 (but no new information is added after zoom 15)
40+
- `{x}` **horizontal position**, counting from the "left", ranges from 0 to variable depending on the zoom
41+
- `{y}` **vertical position**, counting from the "top", ranges from 0 to variable depending on the zoom
42+
43+
### Tile coordinate resources
44+
45+
- MapTiler.org's [Tiles à la Google Maps: Coordinates, Tile Bounds and Projection](http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/) has a great visualization that overlays tile coordinates on an interactive map
46+
- GeoFabrik's [Tile Calculator](http://tools.geofabrik.de/calc/) charts number of tiles per zoom with a customizable bounding box
47+
48+
3149
## Specify layers in the service
3250

3351
Layers to return can specified as `all`, or as one or more layer names separated by commas. Using the `all` layer is more performant.
3452

35-
3653
`buildings`: https://tile.mapzen.com/mapzen/vector/v1/buildings/16/19293/24641.json?api_key=your-mapzen-api-key
3754

3855
`earth,landuse`: https://tile.mapzen.com/mapzen/vector/v1/earth,landuse/16/19293/24641.json?api_key=your-mapzen-api-key
@@ -74,6 +91,74 @@ Mapzen vector tiles can be returned in the following formats.
7491
* [TopoJSON](https://github.com/mbostock/topojson): use the `.topojson` extension. TopoJSON is an optimized form of JSON that saves space by encoding topology and reducing replication of shared geometry.
7592
* [Mapbox-format binary tiles](https://github.com/mapbox/vector-tile-spec): use the `.mvt` extension. This is a compact format using protocol buffers that is used for raster tile rendering in TileMill2 and vector rendering in MapboxGL
7693

94+
## Specify tile size
95+
96+
Optionally a 256 or 512 pixel tile size may be specified. When not specified, the size defaults to 256. Historically, the first web slippy maps were based on 256 pixel sized tiles.
97+
98+
Larger 512 pixel sized tiles offers several benefits:
99+
100+
- **Less tiles, less network requests:** a single 512 request is equivalent to four 256 requests
101+
- **Better labels:** map rendering software like Tangram and MapboxGL have more room to better place labels
102+
- **Smaller overall file sizes:** A larger 512 pixel tile compresses to a smaller file size than when split into four 256 tiles
103+
- **Offline:** Less 512 tiles are needed to cover the same geographic area, and take up less disk space
104+
105+
```
106+
https://tile.mapzen.com/mapzen/vector/v1/{tilesize}/{layers}/{z}/{x}/{y}.{format}?api_key=your-mapzen-api-key
107+
```
108+
109+
### 256 tile size (default)
110+
111+
The suggested max `{z}` value for 256 pixel tiles is zoom **16**. Requesting `{z}` coordinates up to 20 will return a smaller geographic area, but the tile will not include any additional data over the zoom 16 tile.
112+
113+
**Default:**
114+
115+
Including tile size in the path is not required. When not specified the default size of 256 is returned.
116+
117+
```
118+
https://tile.mapzen.com/mapzen/vector/v1/{layers}/{z}/{x}/{y}.{format}?api_key=your-mapzen-api-key
119+
```
120+
121+
**Example Tangram YAML:**
122+
123+
```
124+
sources:
125+
mapzen:
126+
type: MVT
127+
url: https://tile.mapzen.com/mapzen/vector/v1/all/{z}/{x}/{y}.mvt
128+
url_params:
129+
api_key: your-mapzen-api-key
130+
max_zoom: 16
131+
```
132+
133+
**256 in path:**
134+
135+
```
136+
https://tile.mapzen.com/mapzen/vector/v1/256/{layers}/{z}/{x}/{y}.{format}?api_key=your-mapzen-api-key
137+
```
138+
139+
### 512 tile size
140+
141+
The suggested max `{z}` value for 512 pixel tiles is zoom **15**. Requesting `{z}` coordinates up to 20 will return a smaller geographic area, but the tile will not include any additional data over the zoom 15 tile.
142+
143+
**512 in path:**
144+
145+
```
146+
https://tile.mapzen.com/mapzen/vector/v1/512/{layers}/{z}/{x}/{y}.{format}?api_key=your-mapzen-api-key
147+
```
148+
149+
**Example Tangram YAML:**
150+
151+
```
152+
sources:
153+
mapzen:
154+
type: MVT
155+
url: https://tile.mapzen.com/mapzen/vector/v1/512/all/{z}/{x}/{y}.mvt
156+
url_params:
157+
api_key: your-mapzen-api-key
158+
max_zoom: 15
159+
```
160+
161+
77162
## Security
78163

79164
Mapzen Vector Tiles works over HTTPS, in addition to HTTP. You are strongly encouraged to use HTTPS for all requests, especially for queries involving potentially sensitive information.

0 commit comments

Comments
 (0)