|
| 1 | +# TileJSON 2.0.0 |
| 2 | + |
| 3 | +The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", |
| 4 | +"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in |
| 5 | +this document are to be interpreted as described in RFC 2119. |
| 6 | + |
| 7 | +## 1. Purpose |
| 8 | + |
| 9 | +This specification attempts to create a standard for representing |
| 10 | +metadata about multiple types of web-based layers, to aid clients |
| 11 | +in configuration and browsing. |
| 12 | + |
| 13 | +## 2. File format |
| 14 | + |
| 15 | +TileJSON manifest files use the JSON format as described in RFC 4627. |
| 16 | + |
| 17 | +Implementations MUST treat unknown keys as if they weren't present. |
| 18 | +However, implementations MUST expose unknown key/values in their API |
| 19 | +so that API users can optionally handle these keys. Implementations MUST |
| 20 | +treat invalid values for keys as if they weren't present. If the key is |
| 21 | +required, implementations MUST treat the entire TileJSON manifest file |
| 22 | +as invalid and refuse operation. |
| 23 | + |
| 24 | + |
| 25 | +```javascript |
| 26 | +{ |
| 27 | + // REQUIRED. A semver.org style version number. Describes the version of |
| 28 | + // the TileJSON spec that is implemented by this JSON object. |
| 29 | + "tilejson": "2.0.0", |
| 30 | + |
| 31 | + // OPTIONAL. Default: null. A name describing the tileset. The name can |
| 32 | + // contain any legal character. Implementations SHOULD NOT interpret the |
| 33 | + // name as HTML. |
| 34 | + "name": "compositing", |
| 35 | + |
| 36 | + // OPTIONAL. Default: null. A text description of the tileset. The |
| 37 | + // description can contain any legal character. Implementations SHOULD NOT |
| 38 | + // interpret the description as HTML. |
| 39 | + "description": "A simple, light grey world.", |
| 40 | + |
| 41 | + // OPTIONAL. Default: "1.0.0". A semver.org style version number. When |
| 42 | + // changes across tiles are introduces, the minor version MUST change. |
| 43 | + // This may lead to cut off labels. Therefore, implementors can decide to |
| 44 | + // clean their cache when the minor version changes. Changes to the patch |
| 45 | + // level MUST only have changes to tiles that are contained within one tile. |
| 46 | + // When tiles change significantly, the major version MUST be increased. |
| 47 | + // Implementations MUST NOT use tiles with different major versions. |
| 48 | + "version": "1.0.0", |
| 49 | + |
| 50 | + // OPTIONAL. Default: null. Contains an attribution to be displayed |
| 51 | + // when the map is shown to a user. Implementations MAY decide to treat this |
| 52 | + // as HTML or literal text. For security reasons, make absolutely sure that |
| 53 | + // this field can't be abused as a vector for XSS or beacon tracking. |
| 54 | + "attribution": "<a href='http://openstreetmap.org'>OSM contributors</a>", |
| 55 | + |
| 56 | + // OPTIONAL. Default: null. Contains a mustache template to be used to |
| 57 | + // format data from grids for interaction. |
| 58 | + // See https://github.com/mapbox/utfgrid-spec/tree/master/1.2 |
| 59 | + // for the interactivity specification. |
| 60 | + "template": "{{#__teaser__}}{{NAME}}{{/__teaser__}}", |
| 61 | + |
| 62 | + // OPTIONAL. Default: null. Contains a legend to be displayed with the map. |
| 63 | + // Implementations MAY decide to treat this as HTML or literal text. |
| 64 | + // For security reasons, make absolutely sure that this field can't be |
| 65 | + // abused as a vector for XSS or beacon tracking. |
| 66 | + "legend": "Dangerous zones are red, safe zones are green", |
| 67 | + |
| 68 | + // OPTIONAL. Default: "xyz". Either "xyz" or "tms". Influences the y |
| 69 | + // direction of the tile coordinates. |
| 70 | + // The global-mercator (aka Spherical Mercator) profile is assumed. |
| 71 | + "scheme": "xyz", |
| 72 | + |
| 73 | + // REQUIRED. An array of tile endpoints. {z}, {x} and {y} are replaced with |
| 74 | + // the corresponding integers. If multiple endpoints are specified, clients |
| 75 | + // may use any combination of endpoints. All endpoints MUST return the same |
| 76 | + // content for the same URL. The array MUST contain at least one endpoint. |
| 77 | + "tiles": [ |
| 78 | + "http://localhost:8888/admin/1.0.0/world-light,broadband/{z}/{x}/{y}.png" |
| 79 | + ], |
| 80 | + |
| 81 | + // OPTIONAL. Default: []. An array of interactivity endpoints. {z}, {x} |
| 82 | + // and {y} are replaced with the corresponding integers. If multiple |
| 83 | + // endpoints are specified, clients may use any combination of endpoints. |
| 84 | + // All endpoints MUST return the same content for the same URL. |
| 85 | + // If the array doesn't contain any entries, interactivity is not supported |
| 86 | + // for this tileset. |
| 87 | + // See https://github.com/mapbox/mbtiles-spec/blob/master/1.1/interaction.md |
| 88 | + // for the interactivity specification. |
| 89 | + "grids": [ |
| 90 | + "http://localhost:8888/admin/1.0.0/broadband/{z}/{x}/{y}.grid.json" |
| 91 | + ], |
| 92 | + |
| 93 | + // OPTIONAL. Default: 0. >= 0, <= 22. |
| 94 | + // An integer specifying the minimum zoom level. |
| 95 | + "minzoom": 0, |
| 96 | + |
| 97 | + // OPTIONAL. Default: 22. >= 0, <= 22. |
| 98 | + // An integer specifying the maximum zoom level. MUST be >= minzoom. |
| 99 | + "maxzoom": 11, |
| 100 | + |
| 101 | + // OPTIONAL. Default: 4 |
| 102 | + // The pixel resolution of grids, if available, in px/grid square |
| 103 | + "resolution": 4, |
| 104 | + |
| 105 | + // OPTIONAL. Default: [-180, -90, 180, 90]. |
| 106 | + // The maximum extent of available map tiles. Bounds MUST define an area |
| 107 | + // covered by all zoom levels. The bounds are represented in WGS:84 |
| 108 | + // latitude and longitude values, in the order left, bottom, right, top. |
| 109 | + // Values may be integers or floating point numbers. |
| 110 | + "bounds": [ -180, -85.05112877980659, 180, 85.0511287798066 ], |
| 111 | + |
| 112 | + // OPTIONAL. Default: null. |
| 113 | + // The first value is the longitude, the second is latitude (both in |
| 114 | + // WGS:84 values), the third value is the zoom level as an integer. |
| 115 | + // Longitude and latitude MUST be within the specified bounds. |
| 116 | + // The zoom level MUST be between minzoom and maxzoom. |
| 117 | + // Implementations can use this value to set the default location. If the |
| 118 | + // value is null, implementations may use their own algorithm for |
| 119 | + // determining a default location. |
| 120 | + "center": [ -76.275329586789, 39.153492567373, 8 ] |
| 121 | +} |
| 122 | +``` |
| 123 | + |
| 124 | + |
| 125 | +## 3. Caching |
| 126 | + |
| 127 | +Clients MAY cache files retrieved from a remote server. |
| 128 | +When implementations decide to perform caching, they MUST honor valid |
| 129 | +cache control HTTP headers as defined in the HTTP specification for both |
| 130 | +tile images and the TileJSON manifest file. |
0 commit comments