GET /{country}/{version}/{level}/tile/{z}/{x}/{y}.mvt
Mapbox vector tile endpoint. {z}, {x}, and {y} correspond to tile zoom and coordinates used by Mapbox GL (or other vector mapping software) to request a specific tile at a particular zoom level.
Request
- The document declares no server URL.
- Authnone declared
Response
The response is a Mapbox Vector Tile. Use this endpoint as a 'source' of a Mapbox layer, see their docs for more information.
Note that the returned tiles have two layers, a geometry layer, and a label layer. The geometry layer's name is the same as the level parameter used in the request, the label layer's name is level-label (see source-layer in the snippet below). Features returned have three properties: code, name, and level. Currently feature ids are not supported, therefore feature highlighting/restyling in Mapbox GL is not supported.
Example Mapbox GL snippet:
let username = '<your username>';
let password = '<your password>';
mapboxgl.accessToken = '<your access token>';
let map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/light-v9',
zoom: 4,
center: [-100.447303, 37.753574],
// add basic auth for gis requests
transformRequest: (url, resourceType) => {
if(resourceType == 'Tile' && url.startsWith('https://emsiservices.com')) {
return {
url: url,
headers: {
'Authorization': 'Basic ' + btoa(`${username}:${password}`)
}
};
}
}
});
map.on('load', () => {
let level = 'state';
map.addSource('test-source', {
type: 'vector',
tiles: [`https://emsiservices.com/gis/v1/us/2018.3/${level}/tile/{z}/{x}/{y}.mvt`]
});
// geometry layer
map.addLayer({
id: 'test',
type: 'fill',
source: 'test-source',
'source-layer': level,
paint: {
'fill-color': 'blue',
'fill-opacity': 0.6
}
});
// label layer
map.addLayer({
id: 'test-label',
type: 'symbol',
source: 'test-source',
'source-layer': `${level}-label`,
paint: {
'text-color': '#666',
'text-halo-color': 'rgba(255,255,255,0.95)',
'text-halo-width': 2
},
layout: {
'symbol-placement': 'point',
'text-field': "{name}",
'text-font': [
"Open Sans Semibold",
"Arial Unicode MS Bold"
],
'text-letter-spacing': 0.1,
'text-size': 12
}
});
});
Changes
No recorded changes to this operation across all 1 revision of this API.