Ubuntu 16.04.2
Viking 1.6.2-2 (?)
In the case of OpenCycleMaps, the 'API Key Required' watermark is mainly a cosmetic issue as the maps are still accessible. However, various GIS and mapping cloud services accessible via https calls are using API keys for metering and billing, identifying users, and minimising quota theft.
It would be good if it were possible to specify an API key string to be appended to such https calls. In the case of OSRM services it is required for matching trackpoints to throughfares.
Ticket moved from /p/viking/bugs/141/
This has been explicitly addressed in the latest source code for the OpenCycleMap case.
Currently one can override the internal map defaults using the map configuration.
See 'Extending Viking' in the User Manual (although it doesn't mentions that a new set of values can override the internally defined ones). If you define a group that already exists (i.e. by a repeated id key) then you need to define all the other keys as well, otherwise they will be reset to the defaults.
Thus for Cycle Maps put this in your ~/.viking/maps.xml file:
Most if not all other web services Viking uses can be extended (and thus possible to override the internal defaults (or simply create new versions) to set a URL that includes ones own API keys/tokens).
HTH.
Last edit: Rob Norris 2018-08-12
The solution proposed by Rob works but few precisions to be added:
the hostname shall include a subdomain which is either a , b or c (see https://www.thunderforest.com/docs/map-tiles-api/)
You shall spend the time to create a thunderforest account (free for limited per month usage and put the key at the place below.
<objects>
<object class=""> <property name="id">67</property> <property name="label">OpenStreetMap (Cycle)B</property> <property name="name">OSM-CycleB</property> <property name="hostname">a.tile.thunderforest.com</property> <property name="url">/cycle/%d/%d/%d.png?apikey=GET_IT_ON_THUNDERFOREST/property> <property name="zoom-min">0</property> <property name="zoom-max">18</property> <property name="copyright">Tiles courtesy of Andy Allan ©OpenStreetMap contributors</property> <property name="license">CC-BY-SA</property> <property name="license-url">http://www.openstreetmap.org/copyright</property> <property name="file-extension">.png</property> </property></object></objects>
Then enjoy.
Ubuntu 18.04 Bionic Beaver LTS
Viking 1.6.2
OpenStreetMaps (Cycle)
I have tried to change the defaults for Viking 1.6.2 by putting both versions of maps.xml into both ~/.viking/ and ~/.viking-maps . A map I have previously worked upon still comes up with "API Key Required" overlaying the map. I have closed Viking, loaded a new .gpx file, but the "API Key Required" message still appears.
Why has this defaults file worked for other people but not me? How should I begin trouble-shooting? (I am a newbie to Ubuntu, Viking, and OSM.)
Last edit: Hedley Finger 2018-07-28
Rob Norris:
In the line
is "cycle/%d/%/%d" correct? Should this be "cycle/%d/%d/%d", as in @Vaillant 's version?
Last edit: Hedley Finger 2018-07-28
Yes, it should be "cycle/%d/%d/%d".
Now fixed
u/robbieonsea
u/vaillant
There is no need to prepend "a", "b", or "c" to tile.thunderforest.com. The prefixes are just a workaround to allow more requests from a particular domain than some browsers allow.
From https://www.thunderforest.com/docs/map-tiles-api/:
Last edit: Hedley Finger 2018-07-28
u/robbieonsea
u/vaillant
Ubuntu 18.04 Bionic Beaver LTS
Viking 1.7
OpenCycleMaps
I am going nuts here. I still cannot get rid of the "API key required" watermark, even after trying all the above suggestions. I put up with it as it didn't affect my current project. However, I now need to have clean maps for screenshots and PDF notes, etc. The appears not to have been fixed in the code (Viking 1.7). My current
maps.xmlfile contains:I have tried removing the
maps.xmlfile altogether but watermarks still appear, suggesting this issue has not been fixed in the code. Another issue is that Vaillant and Rob differ on the ID value -- is it 17 or 67? I am not a coder, so how can I get a list of IDs for all the extension<object>items embedded in the code? Finally, how do I access OSRM services from within Viking.OK I'll try to explain what I think is going on, but there are several different factors that will effect the behaviour.
You will already have tile images stored on disk (which could have the API key watermark on them). If Viking and/or the server request thinks these images are 'new enough' it won't attempt to get a fresh tile.
You may want to manually delete/move your on disk cache to try to cause a complete refresh so it will definitely be using your API key. This isn't possible via the GUI. The location of the tiles is dependent on the Map Layer configuration (both the map directory and cache layout properties).
With a default directory of ~/.viking-maps, and a OSM layout type the location is:
So simply rename it e.g. ~/.viking-maps/OSM-CycleB-Backup/, and then restart Viking and it will create a fresh ~/.viking-maps/OSM-CycleB/
For the (older) Viking layout style is somewhat more messy as it will be spread over many directories.
Default Map Ids are here: https://sourceforge.net/p/viking/code/ci/master/tree/src/map_ids.h
Here is a snippet:
With the XML configuration file you're free to add any you like, but in my opinion it's best to use Id's greater than 128. If you use an Id that already exists, then any fields you specify (label, hostname, url, etc...) will overwrite whatever the previous values are.
So currently with the above config with the id=17, you should see 'OpenStreetMap (Cycle)B' listed in GUI menu of available maps rather than the default 'OpenStreetMap (Cycle)'.
If instead you used id=67, then you should see both 'OpenStreetMap (Cycle)' and 'OpenStreetMap (Cycle)B' in the available maps menu.
I assume the spaces in property url
Is an unintentional / copy / paste issue here? Otherwise make sure they don't exist in your .xml config as they might cause issues.
ATM I'm not sure what happens when you don't specify a Id number. It's advisable to ensure the name and label fields are unique. I'm not sure what happens if these fields clash between map type entries.
NB There is python tool to convert between the cache layouts, but typically not made available in distributions.
"viking-cache.py" in here https://sourceforge.net/p/viking/code/ci/master/tree/tools/
HTH, I'll address the OSRM usage in a separate message later.
Regarding OSRM;
The GPX output from this service was removed.
https://github.com/Project-OSRM/osrm-backend/issues/1489
As Viking could no longer understand the seemingly bespoke formatted data returned, the option in Viking was removed too.
See some discussion here:
https://github.com/viking-gps/viking/issues/24
Rob:
Thanks for all your help; I am getting there. W.r.t. OSRM data streams, wouldn't it be fairly easy to convert GeoJSON polylines and waypoints to GPX for processing in Viking? If you avoided all the fancy closed geometric shapes. Just ignore the multi-* structures? Or convert all the data structures to polylines and write them back as GeoJSON polylines? I don't think there are too many navigation apps or devices that understand GeoJSON.
I am not a programmer, geometer, or geographer. Have you noticed? I just want to convert my logs into optimised routes!
I think ATM the most expedient method to get something working will be to allow to specify an alternative program to GPSBabel to transform the received data.
So for OSRM could make it a configuration setting to run a geojson to gpx program e.g. togpx -> https://github.com/tyrasd/togpx
Remains to be seen if this actually works for the OSRM JSON, but should be quick to implement with the current code structure.
One slight difficulty is how to set up command line parameters in the configuration (that is flexible to work for a variety of programs...)