[#102] MapBox tiles require access token
This commit is contained in:
parent
86c4fbdbf7
commit
414255e34a
|
@ -39,11 +39,12 @@
|
|||
|
||||
if (mapConfig.type == 'mapbox') {
|
||||
// MapBox base map
|
||||
if (!mapConfig['mapbox.map_id']) {
|
||||
throw '[CKAN Map Widgets] You need to provide a map ID ([account].[handle]) when using a MapBox layer. ' +
|
||||
if (!mapConfig['mapbox.map_id'] || !mapConfig['mapbox.access_token']) {
|
||||
throw '[CKAN Map Widgets] You need to provide a map ID ([account].[handle]) and an access token when using a MapBox layer. ' +
|
||||
'See http://www.mapbox.com/developers/api-overview/ for details';
|
||||
}
|
||||
baseLayerUrl = '//{s}.tiles.mapbox.com/v3/{handle}/{z}/{x}/{y}.png';
|
||||
|
||||
baseLayerUrl = '//{s}.tiles.mapbox.com/v4/' + mapConfig['mapbox.map_id'] + '/{z}/{x}/{y}.png?access_token=' + mapConfig['mapbox.access_token'];
|
||||
leafletBaseLayerOptions.handle = mapConfig['mapbox.map_id'];
|
||||
leafletBaseLayerOptions.subdomains = mapConfig.subdomains || 'abcd';
|
||||
leafletBaseLayerOptions.attribution = mapConfig.attribution || 'Data: <a href="http://osm.org/copyright" target="_blank">OpenStreetMap</a>, Design: <a href="http://mapbox.com/about/maps" target="_blank">MapBox</a>';
|
||||
|
|
|
@ -36,12 +36,13 @@ MapBox
|
|||
++++++
|
||||
|
||||
`MapBox`_ allows to define your custom maps based on OpenStreetMap data, using
|
||||
their online editor or the more advanced `TileMill`_ desktop tool. You will
|
||||
need to provide a map id with the ``[account].[handle]`` form (Check `here`_
|
||||
for more details)::
|
||||
their online editor or the more advanced `MapBox Studio`_ desktop tool. You will
|
||||
need to provide a map id with the ``[account].[handle]`` form and and access token
|
||||
(Check `here`_ for more details)::
|
||||
|
||||
ckanext.spatial.common_map.type = mapbox
|
||||
ckanext.spatial.common_map.mapbox.map_id = youraccount.map-xxxxxxxx
|
||||
ckanext.spatial.common_map.mapbox.access_token = pk.ey...
|
||||
|
||||
.. image:: _static/base-map-mapbox.png
|
||||
|
||||
|
@ -124,7 +125,7 @@ And this for a primary content map::
|
|||
.. _MapQuest-OSM: http://developer.mapquest.com/web/products/open/map
|
||||
.. _MapQuest: http://www.mapquest.com/
|
||||
.. _MapBox: http://www.mapbox.com/
|
||||
.. _TileMill: http://www.mapbox.com/tilemill/
|
||||
.. _MapBox Studio: https://www.mapbox.com/mapbox-studio
|
||||
.. _here: http://www.mapbox.com/developers/api-overview/
|
||||
.. _`Leaflet URL template`: http://leafletjs.com/reference.html#url-template
|
||||
.. _Stamen: http://stamen.com/
|
||||
|
|
Loading…
Reference in New Issue