]> git.openstreetmap.org Git - nominatim.git/blobdiff - website/js/nominatim-ui.js
Reverse geocode include geometry - added bounding box tests
[nominatim.git] / website / js / nominatim-ui.js
index 1a3ae15043df2d77fa7d7a1710e75e1d91be8a53..3e0aabd2370fba5b52627ed37bd64b7e8ec38b1c 100644 (file)
@@ -10,30 +10,23 @@ jQuery(document).on('ready', function(){
        $('#q').focus();
 
        map = new L.map('map', {
-                               attributionControl: false, // moved to page footer
+                               attributionControl: (nominatim_map_init.tile_attribution && nominatim_map_init.tile_attribution.length),
                                scrollWheelZoom:    !L.Browser.touch,
                                touchZoom:          false
                        });
 
-
-
-       L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
-               noWrap: true // otherwise we end up with click coordinates like latitude -728
+       L.tileLayer(nominatim_map_init.tile_url, {
+               noWrap: true, // otherwise we end up with click coordinates like latitude -728
                // moved to footer
-               // attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
+               attribution: (nominatim_map_init.tile_attribution || null ) //'&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
        }).addTo(map);
 
-       if ( nominatim_map_init.lat ){
-               map.setView([nominatim_map_init.lat || 0, nominatim_map_init.lon], nominatim_map_init.zoom);
-
-               if ( is_reverse_search ){
-                       // not really a market, but the .circle changes radius once you zoom in/out
-                       var cm = L.circleMarker([nominatim_map_init.lat,nominatim_map_init.lon], { radius: 5, weight: 2, fillColor: '#ff7800', color: 'red', opacity: 0.75, clickable: false});
-                       cm.addTo(map);
-               }
+       map.setView([nominatim_map_init.lat, nominatim_map_init.lon], nominatim_map_init.zoom);
 
-       } else {
-               map.setView([0,0],2);
+       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([nominatim_map_init.lat,nominatim_map_init.lon], { radius: 5, weight: 2, fillColor: '#ff7800', color: 'red', opacity: 0.75, clickable: false});
+               cm.addTo(map);
        }
 
 
@@ -124,7 +117,7 @@ jQuery(document).on('ready', function(){
 
                        var bounds = [[result.aBoundingBox[0]*1,result.aBoundingBox[2]*1], [result.aBoundingBox[1]*1,result.aBoundingBox[3]*1]];
                        map.fitBounds(bounds);
-                       if (result.astext && result.astext.match(/POLY/) ){
+                       if (result.astext && result.astext.match(/(POLY)|(LINE)/) ){
                                var layer = omnivore.wkt.parse(result.astext);
                                layerGroup.addLayer(layer);
                        }
@@ -188,16 +181,18 @@ jQuery(document).on('ready', function(){
                map = new L.map('map', {
                                        // center: [nominatim_map_init.lat, nominatim_map_init.lon],
                                        // zoom:   nominatim_map_init.zoom,
-                                       attributionControl: false,
+                                       attributionControl: (nominatim_map_init.tile_attribution && nominatim_map_init.tile_attribution.length),
                                        scrollWheelZoom:    false,
                                        touchZoom:          false,
                                });
 
-               L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
+
+               L.tileLayer(nominatim_map_init.tile_url, {
                        // moved to footer
-                       // attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
+                       attribution: (nominatim_map_init.tile_attribution || null ) //'&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
                }).addTo(map);
 
+
                var layerGroup = new L.layerGroup().addTo(map);
 
                var circle = L.circleMarker([nominatim_result.lat,nominatim_result.lon], { radius: 10, weight: 2, fillColor: '#ff7800', color: 'blue', opacity: 0.75});