From: marc tobias Date: Sun, 1 May 2016 08:47:13 +0000 (+0200) Subject: UI: the result outline (geojson/polygon) now lets the map handle its clicks X-Git-Tag: v3.0.0~174^2 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/9e1421fb6cfe468b3ed594c68ea579b4977c67b5 UI: the result outline (geojson/polygon) now lets the map handle its clicks --- diff --git a/website/js/nominatim-ui.js b/website/js/nominatim-ui.js index 3e0aabd2..31044d02 100644 --- a/website/js/nominatim-ui.js +++ b/website/js/nominatim-ui.js @@ -118,8 +118,12 @@ 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)|(LINE)/) ){ - var layer = omnivore.wkt.parse(result.astext); - layerGroup.addLayer(layer); + var geojson_layer = L.geoJson(null, { + // http://leafletjs.com/reference.html#geojson-style + style: function(feature) { return { clickable: false, color: 'blue' }; } + }); + omnivore.wkt.parse(result.astext,null,geojson_layer); + layerGroup.addLayer(geojson_layer); } else { // var layer = L.rectangle(bounds, {color: "#ff7800", weight: 1} ); @@ -199,9 +203,14 @@ jQuery(document).on('ready', function(){ map.addLayer(circle); if ( nominatim_result.outlinestring ){ - var outline = omnivore.wkt.parse(nominatim_result.outlinestring); - map.addLayer(outline); - map.fitBounds(outline.getBounds()); + + var geojson_layer = L.geoJson(null, { + // http://leafletjs.com/reference.html#geojson-style + style: function(feature) { return { clickable: false, color: 'blue' }; } + }); + omnivore.wkt.parse(nominatim_result.outlinestring,null,geojson_layer); + layerGroup.addLayer(geojson_layer); + map.fitBounds(geojson_layer.getBounds()); } else { map.setView([nominatim_result.lat,nominatim_result.lon],10); }