-
-
-
-function init_map_on_search_page(is_reverse_search, nominatim_results, request_lat, request_lon, init_zoom) {
-
- map = new L.map('map', {
- // center: [nominatim_map_init.lat, nominatim_map_init.lon],
- // zoom: nominatim_map_init.zoom,
- attributionControl: (get_config_value('Map_Tile_Attribution') && get_config_value('Map_Tile_Attribution').length),
- scrollWheelZoom: true, // !L.Browser.touch,
- touchZoom: false,
- });
-
-
- L.tileLayer(get_config_value('Map_Tile_URL'), {
- noWrap: true, // otherwise we end up with click coordinates like latitude -728
- // moved to footer
- attribution: (get_config_value('Map_Tile_Attribution') || null ) //'© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
- }).addTo(map);
-
- // console.log(Nominatim_Config);
-
- map.setView([request_lat, request_lon], init_zoom);
-
- var osm2 = new L.TileLayer(get_config_value('Map_Tile_URL'), {minZoom: 0, maxZoom: 13, attribution: (get_config_value('Map_Tile_Attribution') || null )});
- var miniMap = new L.Control.MiniMap(osm2, {toggleDisplay: true}).addTo(map);
-
- if (is_reverse_search) {
- // We don't need a marker, but an L.circle instance changes radius once you zoom in/out
- var cm = L.circleMarker([request_lat, request_lon], { radius: 5, weight: 2, fillColor: '#ff7800', color: 'red', opacity: 0.75, clickable: false});
- cm.addTo(map);
+function init_map_on_search_page(is_reverse_search, nominatim_results, request_lat,
+ request_lon, init_zoom) {
+
+ var attribution = get_config_value('Map_Tile_Attribution') || null;
+ map = new L.map('map', {
+ // center: [nominatim_map_init.lat, nominatim_map_init.lon],
+ // zoom: nominatim_map_init.zoom,
+ attributionControl: (attribution && attribution.length),
+ scrollWheelZoom: true, // !L.Browser.touch,
+ touchZoom: false
+ });
+
+
+ L.tileLayer(get_config_value('Map_Tile_URL'), {
+ // moved to footer
+ // '© <a href="https://osm.org/copyright">OpenStreetMap</a> contributors'
+ attribution: attribution
+ }).addTo(map);
+
+ // console.log(Nominatim_Config);
+
+ map.setView([request_lat, request_lon], init_zoom);
+
+ var osm2 = new L.TileLayer(get_config_value('Map_Tile_URL'), {
+ minZoom: 0,
+ maxZoom: 13,
+ attribution: attribution
+ });
+ new L.Control.MiniMap(osm2, { toggleDisplay: true }).addTo(map);
+
+ if (is_reverse_search) {
+ // We don't need a marker, but an L.circle instance changes radius once you zoom in/out
+ var cm = L.circleMarker(
+ [request_lat, request_lon],
+ {
+ radius: 5,
+ weight: 2,
+ fillColor: '#ff7800',
+ color: 'red',
+ opacity: 0.75,
+ zIndexOffset: 100,
+ clickable: false
+ }
+ );
+ cm.addTo(map);
+ } else {
+ var search_params = new URLSearchParams(window.location.search);
+ var viewbox = search_params.get('viewbox');
+ if (viewbox) {
+ var coords = viewbox.split(','); // <x1>,<y1>,<x2>,<y2>
+ var bounds = L.latLngBounds([coords[1], coords[0]], [coords[3], coords[2]]);
+ L.rectangle(bounds, {
+ color: '#69d53e',
+ weight: 3,
+ dashArray: '5 5',
+ opacity: 0.8,
+ fill: false
+ }).addTo(map);