-
- 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);
+ //
+ 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'), {
+ // moved to footer
+ attribution: (get_config_value('Map_Tile_Attribution') || null ) // '© <a href="https://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 ) });
+ 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);
+ }
+
+ var MapPositionControl = L.Control.extend({
+ options: {
+ position: 'topright'
+ },
+ onAdd: function (/* map */) {
+ var container = L.DomUtil.create('div', 'my-custom-control');
+
+ $(container).text('show map bounds').addClass('leaflet-bar btn btn-sm btn-default').on('click', function (e) {
+ e.preventDefault();
+ e.stopPropagation();
+ $('#map-position').show();
+ $(container).hide();
+ });
+ $('#map-position-close a').on('click', function (e) {
+ e.preventDefault();
+ e.stopPropagation();
+ $('#map-position').hide();
+ $(container).show();
+ });
+
+ return container;