ckan / ckanext-spatial

Geospatial extension for CKAN
http://docs.ckan.org/projects/ckanext-spatial
125 stars 190 forks source link

Support MapQuest AppKey #157

Open MrkGrgsn opened 8 years ago

MrkGrgsn commented 8 years ago

Since 11 July 2016 MapQuest requires an AppKey in order to load tiles. ckanext-spatial configured to use MapQuest displays an error message directing users to MapQuest's blog instead of the map tiles.

amercader commented 8 years ago

Wow, that's disappointing, I totally missed any previous announcement. That's bound to affect many people as MapQuest was the default option on all spatial widgets.

It looks like the way to go is to use their Leaflet plugin (or switch provider).

It's unlikely that I'd have time to work on that on the near future, so if someone from the many sites affected wants to jump in I can definitely help with a spec and guidance.

amercader commented 8 years ago

BTW does anyone know of a free alternative to use as default tiles?

Zharktas commented 8 years ago

We also need to do something about this since the maps are now broken in our instance. But since the whole Finnish public sector is on vacation during July and our another ckan project which should launch multiple instances and probably needs maps won't be starting for another month , we can't do pretty much anything right now.

jayhuggins commented 8 years ago

Looks like a quick solution is to change the following in ckanext-spatial/ckanext/spatial/public/js/common_map.js, from:

baseLayerUrl = '//otile{s}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png’

to

baseLayerUrl = '//a.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png’;

Here are some other tile server options: http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Tile_servers

amercader commented 8 years ago

I summarized the available options (Excerpt from https://lists.okfn.org/pipermail/ckan-dev/2016-July/010124.html)

You can provide a working alternative right now without any code change, just by configuring an alternative base layer. The recommended options are:

  1. MapBox. Register for an account and get an access token. Then set the following configuration on your ini file:

    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...
  2. Other tile providers. There are a couple of other free tile providers that don't require registration or have free plans. Thunderforest offers OSM based tiles. (registration is recommended). Here are the configuration options that you should use:

    ckanext.spatial.common_map.type = custom
    ckanext.spatial.common_map.custom.url = https://{s}.tile.thunderforest.com/transport/{z}/{x}/{y}.png
    ckanext.spatial.common_map.attribution = Maps &copy; <a href="http://www.thunderforest.com">Thunderforest</a>, Data &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>

    Maptiles offers two base maps based on OSM. (I'd recommend clarify with the author its terms of use):

    ckanext.spatial.common_map.type = custom
    ckanext.spatial.common_map.custom.url = http://{s}.osm.maptiles.xyz/{z}/{x}/{y}.png
    ckanext.spatial.common_map.attribution = &copy <a href="http://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors. Tiles provided by <a href="https://maptiles.xyz">MapTiles</a>.

Note: Please if you are using the widgets on a production site consider checking the terms for all options described here, and do not hesitate to contact any of them if you have any doubts regarding usage.

amercader commented 8 years ago

@jayhuggins you don't need to change the source code to access these tiles, have a look above for the relevant config options

JJediny commented 8 years ago

Some other Basemap tile services not yet mentioned:

BE SURE to check that your use is covered by each service's Terms/Conditions and Attribution requirements - but none of the following require an API Key:

Open Map Surfer Boundaries

http://openmapsurfer.uni-hd.de/tiles/adminb/x={x}&y={y}&z={z}

Hike Bike

http://{s}.tiles.wmflabs.org/hikebike/{z}/{x}/{y}.png

CartoDB Dark Matter

http://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png

ESRI World Imagery

http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}

OpenCycle Map

http://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png

Stamen Terrain

http://{s}.tile.stamen.com/terrain/{z}/{x}/{y}.png

Stamen Toner

http://{s}.tile.stamen.com/toner/{z}/{x}/{y}.png

OSM Humanitarian

http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png

lukecampbell commented 8 years ago

:+1: for filing an issue :-1: for this ever becoming an issue (MapQuest)