rinigus / pure-maps

Maps and navigation
https://rinigus.github.io/pure-maps/
GNU General Public License v3.0
248 stars 43 forks source link

setting default service providers (basemap and routing) at build time #420

Closed craftyguy closed 3 years ago

craftyguy commented 3 years ago

Is there a 'supported'/recommended way to change the basemap and routing providers at build time, e.g. change from mapbox to opencyclemap, etc?

poor/config.py seems relevant, but wanted to ask here in case there's some better way

https://github.com/rinigus/pure-maps/blob/master/poor/config.py#L75

craftyguy commented 3 years ago

I tried changing them in the DEFAULT dict in config.py, but it still defaulted to using mapbox/stadia

Here's the patch I hacked up:

diff --git a/poor/config.py b/poor/config.py
index 33228c5..81dd7d4 100644
--- a/poor/config.py
+++ b/poor/config.py
@@ -72,16 +72,16 @@ DEFAULTS = {
     "profile": "online",
     "profiles": {
         "mixed": {
-            "basemap": "Mapbox",
+            "basemap": "opencyclemap",
             "geocoder": "photon",
             "guide": "foursquare",
-            "router": "stadiamaps"
+            "router": "osrm"
         },
         "online": {
-            "basemap": "Mapbox",
+            "basemap": "opencyclemap",
             "geocoder": "photon",
             "guide": "foursquare",
-            "router": "stadiamaps"
+            "router": "osrm"
         },
         "offline": {
             "basemap": "OSM Scout",

Ideally there would be a build-time option for selecting these, e.g. something like:

make CFLAGS="-DDEFAULT_MAPBASE=opencyclemap -DDEFAULT_ROUTER=osrm"

since carrying around an out of tree patch to do this is less than ideal for packagers.

rinigus commented 3 years ago

Changing the DEFAULT should be sufficient. Make sure that you remove configs from ~/.config before testing. After Pure Maps start, it will write configuration file and even if you change defaults the user settings are preferred. If you wipe the configs, it should work.

@PureTryOut : The preference of these providers was set as

I don't mind having a build option in make. Notice that right now we don't compile anything, but this will most probably change as I get time to rewrite navigation part with C++ main() expected then.

rinigus commented 3 years ago

As build system is expected to change, maybe you should use a patch for now and make proper selector later when the build system will stabilize.

craftyguy commented 3 years ago

Thanks for the help. I think I got something that works, took me a while to figure out the correct names/casing..

rinigus commented 3 years ago

Fix will come out with the next release with the options described in README (branch not merged yet, see commit above). Closing

craftyguy commented 3 years ago

Awesome, thank you for implementing this!