diff --git a/config.template.js b/config.template.js index 4604bf0..a2627b5 100644 --- a/config.template.js +++ b/config.template.js @@ -127,4 +127,6 @@ // regex needs to be in sync with server, see ServerHandler.getTrackName() BR.conf.tracknameAllowedChars = 'a-zA-Z0-9 \\._\\-'; + + BR.conf.overpassBaseUrl = 'https://overpass.kumi.systems/api/interpreter'; })(); diff --git a/index.html b/index.html index a3ec7aa..6e32d90 100644 --- a/index.html +++ b/index.html @@ -171,7 +171,11 @@
Administrative Boundaries: OSM-Boundaries, - Overpass API + Overpass API +
+
+ Locations (POIs): + Overpass API
Elevation data
diff --git a/js/LayersConfig.js b/js/LayersConfig.js index ee56372..c335fdf 100644 --- a/js/LayersConfig.js +++ b/js/LayersConfig.js @@ -1,7 +1,5 @@ BR.LayersConfig = L.Class.extend({ - overpassFrontend: new OverpassFrontend( - (BR.conf.overpassBaseUrl || '//overpass-api.de/api/interpreter').replace('?data=', '') - ), + overpassFrontend: new OverpassFrontend(BR.conf.overpassBaseUrl || '//overpass-api.de/api/interpreter'), defaultBaseLayers: BR.confLayers.defaultBaseLayers, defaultOverlays: BR.confLayers.defaultOverlays, legacyNameToIdMap: BR.confLayers.legacyNameToIdMap, @@ -176,7 +174,7 @@ BR.LayersConfig = L.Class.extend({ _showOverpassLoadingIndicator: function () { this._overpassActiveRequestCount++; - this._overpassLoadingIndicator.showInfo(i18next.t('layers.overpass-loading-indicator')); + this._overpassLoadingIndicator.showLoading(i18next.t('layers.overpass-loading-indicator')); }, _hideOverpassLoadingIndicator: function () { @@ -196,6 +194,9 @@ BR.LayersConfig = L.Class.extend({ body: '{% for k, v in tags %}{% if k[:5] != "addr:" %}{% endif %}{% endfor %}
{{ k }}{% if k matches "/email/" %}{{ v }}{% elseif v matches "/^http/" %}{{ v }}{% elseif v matches "/^www/" %}{{ v }}{% else %}{{ v }}{% endif %}
', markerSymbol: null, + style: function (overpassObject) { + return this.defaultBaseLayers?.[0] === 'cyclosm' ? { color: 'darkorange' } : {}; + }.bind(this), }, }), { diff --git a/js/Map.js b/js/Map.js index d772e11..2995a36 100644 --- a/js/Map.js +++ b/js/Map.js @@ -56,6 +56,10 @@ BR.Map = { $('#credits').on('show.bs.modal', function (event) { BR.Map._renderLayerCredits(layersControl._layers); + const overpassUrl = new URL(BR.conf.overpassBaseUrl || 'https://overpass-api.de').origin; + for (const link of document.getElementsByClassName('overpass-url')) { + link.href = overpassUrl; + } }); new L.Control.PermalinkAttribution().addTo(map); diff --git a/js/control/Message.js b/js/control/Message.js index 9b91109..497204f 100644 --- a/js/control/Message.js +++ b/js/control/Message.js @@ -24,6 +24,10 @@ BR.Message = L.Class.extend({ iconClass = 'fa-exclamation-triangle'; alertClass = 'alert-warning'; break; + case 'loading': + iconClass = 'fa-spinner fa-pulse'; + alertClass = 'alert-secondary'; + break; default: case 'info': iconClass = 'fa-info-circle'; @@ -83,6 +87,10 @@ BR.Message = L.Class.extend({ showInfo: function (msg) { this._show(msg, 'info'); }, + + showLoading: function (msg) { + this._show(msg, 'loading'); + }, }); // static instance as global control diff --git a/js/plugin/CircleGoArea.js b/js/plugin/CircleGoArea.js index f43a5d5..78939d3 100644 --- a/js/plugin/CircleGoArea.js +++ b/js/plugin/CircleGoArea.js @@ -11,7 +11,7 @@ BR.CircleGoArea = L.Control.extend({ options: { countriesUrl: BR.conf.countriesUrl || 'dist/boundaries/countries.topo.json', statesUrl: BR.conf.statesUrl || 'dist/boundaries/germany-states.topo.json', - overpassBaseUrl: BR.conf.overpassBaseUrl || 'https://overpass-api.de/api/interpreter?data=', + overpassDataUrl: (BR.conf.overpassBaseUrl || 'https://overpass-api.de/api/interpreter') + '?data=', shortcut: { draw: { enable: 73, // char code for 'i' @@ -137,7 +137,7 @@ BR.CircleGoArea = L.Control.extend({ query += '(area.a[admin_level="' + adminLevelFallback + '"];)->.p; relation(pivot.p); out geom;'; } - var url = this.options.overpassBaseUrl + encodeURIComponent(query); + var url = this.options.overpassDataUrl + encodeURIComponent(query); this.marker.setIcon(this.iconSpinner); BR.Util.getJson( diff --git a/js/plugin/leaflet-fullHash.js b/js/plugin/leaflet-fullHash.js index 6254f62..de9a950 100644 --- a/js/plugin/leaflet-fullHash.js +++ b/js/plugin/leaflet-fullHash.js @@ -129,6 +129,11 @@ L.bind(function (obj, index, array) { if (obj) { layersControl.activateLayer(obj); + if (obj.layer instanceof OverpassLayer) { + // hack to select overlay (mark checked) in the layers control + // (OverpassLayer._layerAdd does not fire 'add' event) + layersControl._update(); + } if (obj && !obj.overlay) { added = true; } diff --git a/locales/en.json b/locales/en.json index 7c2eedc..685703b 100644 --- a/locales/en.json +++ b/locales/en.json @@ -15,7 +15,7 @@ "tooltip": "Show more information about BRouter-Web" }, "credits": { - "boundaries": "Administrative Boundaries: OSM-Boundaries, Overpass API", + "boundaries": "Administrative Boundaries: OSM-Boundaries, Overpass API", "brouter": "BRouter", "brouter-license": "BRouter © Arndt Brenschede", "elevation-data": "Elevation data", @@ -25,6 +25,7 @@ "map-tiles": "Map tiles", "nominatim": "Search by Nominatim", "openstreetmap": "© OpenStreetMap contributors under ODbL", + "pois": "Locations (POIs): Overpass API", "title": "Credits" }, "export": { @@ -236,6 +237,7 @@ "europe": "Europe", "europe-monolingual": "Europe monolingual", "overlays": "Overlays", + "overpass": "Locations (POIs)", "worldwide": "Worldwide", "worldwide-international": "Worldwide international", "worldwide-monolingual": "Worldwide monolingual" diff --git a/locales/keys.js b/locales/keys.js index 498a56c..ceba32f 100644 --- a/locales/keys.js +++ b/locales/keys.js @@ -61,4 +61,5 @@ i18next.t('sidebar.layers.category.overlays', 'Overlays'); i18next.t('sidebar.layers.category.worldwide', 'Worldwide'); i18next.t('sidebar.layers.category.worldwide-international', 'Worldwide international'); i18next.t('sidebar.layers.category.worldwide-monolingual', 'Worldwide monolingual'); +i18next.t('sidebar.layers.category.overpass', 'Locations (POIs)'); i18next.t('sidebar.layers.tooltip');