X-Git-Url: https://git.street.me.uk/andy/viking.git/blobdiff_plain/5ae894dc5b3187b14da400a1f0635adb3ac6ceac..3f31bec4a6927651bc562e8b21aa0c7354328e1b:/src/osm.c diff --git a/src/osm.c b/src/osm.c index d25d5ce6..c7cdf128 100644 --- a/src/osm.c +++ b/src/osm.c @@ -27,7 +27,6 @@ #include #include "osm.h" -#include "osrm.h" #include "vikmapslayer.h" #include "vikslippymapsource.h" #include "vikwmscmapsource.h" @@ -39,7 +38,7 @@ #include "vikgotoxmltool.h" #include "vikgoto.h" #include "vikrouting.h" -#include "osrm.h" +#include "vikroutingwebengine.h" /* initialisation */ void osm_init () { @@ -59,7 +58,7 @@ void osm_init () { VIK_MAP_SOURCE(g_object_new(VIK_TYPE_SLIPPY_MAP_SOURCE, "id", 17, "label", "OpenStreetMap (Cycle)", - "hostname", "b.tile.opencyclemap.org", + "hostname", "tile.opencyclemap.org", "url", "/cycle/%d/%d/%d.png", "check-file-server-time", TRUE, "use-etag", FALSE, @@ -71,7 +70,7 @@ void osm_init () { VIK_MAP_SOURCE(g_object_new(VIK_TYPE_SLIPPY_MAP_SOURCE, "id", 20, "label", "OpenStreetMap (Transport)", - "hostname", "c.tile2.opencyclemap.org", + "hostname", "tile2.opencyclemap.org", "url", "/transport/%d/%d/%d.png", "check-file-server-time", TRUE, "use-etag", FALSE, @@ -79,18 +78,6 @@ void osm_init () { "license", "CC-BY-SA", "license-url", "http://www.openstreetmap.org/copyright", NULL)); - VikMapSource *wms_type = - VIK_MAP_SOURCE(g_object_new(VIK_TYPE_WMSC_MAP_SOURCE, - "id", 18, - "label", "OpenStreetMap (WMS)", - "hostname", "full.wms.geofabrik.de", - "url", "/std/demo_key?LAYERS=osm-full&FORMAT=image/png&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=&SRS=EPSG:4326&BBOX=%s,%s,%s,%s&WIDTH=256&HEIGHT=256", - "check-file-server-time", FALSE, - "copyright", "© OpenStreetMap contributors", - "license", "CC-BY-SA", - "license-url", "http://www.openstreetmap.org/copyright", - NULL)); - VikMapSource *mapquest_type = VIK_MAP_SOURCE(g_object_new(VIK_TYPE_SLIPPY_MAP_SOURCE, "id", 19, @@ -103,6 +90,18 @@ void osm_init () { "license", "MapQuest Specific", "license-url", "http://developer.mapquest.com/web/info/terms-of-use", NULL)); + VikMapSource *hot_type = + VIK_MAP_SOURCE(g_object_new(VIK_TYPE_SLIPPY_MAP_SOURCE, + "id", 22, + "label", "OpenStreetMap (Humanitarian)", + "hostname", "c.tile.openstreetmap.fr", + "url", "/hot/%d/%d/%d.png", + "check-file-server-time", TRUE, + "use-etag", FALSE, + "copyright", "© OpenStreetMap contributors. Tiles courtesy of Humanitarian OpenStreetMap Team", + "license", "CC-BY-SA", + "license-url", "http://www.openstreetmap.org/copyright", + NULL)); // NB no cache needed for this type!! VikMapSource *direct_type = @@ -114,16 +113,28 @@ void osm_init () { "use-direct-file-access", TRUE, NULL)); + // NB no cache needed for this type!! + VikMapSource *mbtiles_type = + VIK_MAP_SOURCE(g_object_new(VIK_TYPE_SLIPPY_MAP_SOURCE, + "id", 23, + "label", _("MBTiles File"), + // For using your own generated data assumed you know the license already! + "copyright", "© OpenStreetMap contributors", // probably + "use-direct-file-access", TRUE, + "is-mbtiles", TRUE, + NULL)); + maps_layer_register_map_source (mapquest_type); maps_layer_register_map_source (mapnik_type); maps_layer_register_map_source (cycle_type); maps_layer_register_map_source (transport_type); - maps_layer_register_map_source (wms_type); + maps_layer_register_map_source (hot_type); maps_layer_register_map_source (direct_type); + maps_layer_register_map_source (mbtiles_type); // Webtools VikWebtoolCenter *webtool = NULL; - webtool = vik_webtool_center_new_with_members ( _("OSM (view)"), "http://openstreetmap.org/?lat=%s&lon=%s&zoom=%d&layers=B000FTF" ); + webtool = vik_webtool_center_new_with_members ( _("OSM (view)"), "http://openstreetmap.org/?lat=%s&lon=%s&zoom=%d" ); vik_ext_tools_register ( VIK_EXT_TOOL ( webtool ) ); g_object_unref ( webtool ); @@ -142,18 +153,12 @@ void osm_init () { vik_ext_tools_register ( VIK_EXT_TOOL ( webtoolbounds ) ); g_object_unref ( webtoolbounds ); - // NB: THERE MUST BE AT LEAST ONE VikWebtoolDatasource defined otherwise the parsing of the datasource.xml will fail - // since it won't know about such a GObject type existing! - // (in fact this is a problem in the vikgobjectbuilder -> g_markup_parse_context_parse -> _start_element -> g_type_from_name ) + // Datasource VikWebtoolDatasource *vwtds = NULL; vwtds = vik_webtool_datasource_new_with_members ( _("OpenStreetMap Notes"), "http://api.openstreetmap.org/api/0.6/notes.gpx?bbox=%s,%s,%s,%s&closed=0", "LBRT", NULL ); vik_ext_tool_datasources_register ( VIK_EXT_TOOL ( vwtds ) ); g_object_unref ( vwtds ); - vwtds = vik_webtool_datasource_new_with_members ( _("OpenStreetBugs"), "http://openstreetbugs.schokokeks.org/api/0.1/getGPX?l=%s&r=%s&b=%s&t=%s&open=only_open_bugs", "LRBT", NULL ); - vik_ext_tool_datasources_register ( VIK_EXT_TOOL ( vwtds ) ); - g_object_unref ( vwtds ); - // Goto VikGotoXmlTool *nominatim = VIK_GOTO_XML_TOOL ( g_object_new ( VIK_GOTO_XML_TOOL_TYPE, "label", "OSM Nominatim", "url-format", "http://nominatim.openstreetmap.org/search?q=%s&format=xml", @@ -180,7 +185,16 @@ void osm_init () { vik_ext_tools_register ( VIK_EXT_TOOL ( webtool ) ); g_object_unref ( webtool ); - OsrmRouting *osrm = osrm_routing_new ( ); + /* See API references: https://github.com/DennisOSRM/Project-OSRM/wiki/Server-api */ + VikRoutingEngine *osrm = g_object_new ( VIK_ROUTING_WEB_ENGINE_TYPE, + "id", "osrm", + "label", "OSRM", + "format", "gpx", + "url-base", "http://router.project-osrm.org/viaroute?output=gpx", + "url-start-ll", "&loc=%s,%s", + "url-stop-ll", "&loc=%s,%s", + "url-via-ll", "&loc=%s,%s", + NULL); vik_routing_register ( VIK_ROUTING_ENGINE ( osrm ) ); g_object_unref ( osrm ); }