]> git.openstreetmap.org Git - nominatim-ui.git/commitdiff
display of geojson works
authorMarc Tobias Metten <mtmail@gmx.net>
Thu, 8 Mar 2018 15:05:43 +0000 (16:05 +0100)
committerMarc Tobias Metten <mtmail@gmx.net>
Thu, 8 Mar 2018 15:05:43 +0000 (16:05 +0100)
TODO.md
src/assets/js/base.js
src/assets/js/searchpage.js
src/templates/searchpage.hbs

diff --git a/TODO.md b/TODO.md
index 655455a18bd45036280126b71fe683ba9f24d14a..23d30f4c922e299c56826a99593001ec6623dd1f 100644 (file)
--- a/TODO.md
+++ b/TODO.md
    * need /details to support &format=json
 * reverse: zoom not set
 http://localhost:8000/reverse.html?format=html&lat=52.3755991766591&lon=7.646484374999999&zoom=
-* search page: add pagination, moreurl
-* search page: add viewbox
+* !search page: add pagination, moreurl
 * details page: add "There are more child objects which are not shown" back in
 * set acceptlanguage to API request
 * move this TODO.txt to github issues
 * write install instructions
 * check output of /dist into repository
+* use polygon_geojson, not polygon parameter
 
 
 ## Unknown
index d72fc79b2af273dc192b037e991b7141b19085fc..02c228ace139c9d402b9f56ce1162df528d04e07 100644 (file)
@@ -10,7 +10,7 @@ function get_config_value(str, default_val) {
     return (typeof Nominatim_Config[str] !== 'undefined' ? Nominatim_Config[str] :  default_val);
 }
 
-function parse_and_normalize_geojson_string(raw_string){
+function parse_and_normalize_geojson_string(part){
     // normalize places the geometry into a featurecollection, similar to
     // https://github.com/mapbox/geojson-normalize
     var parsed_geojson = {
@@ -18,7 +18,7 @@ function parse_and_normalize_geojson_string(raw_string){
         features: [
             {
                 type: "Feature",
-                geometry: JSON.parse(raw_string),
+                geometry: part,
                 properties: {}
             }
         ]
index e0754ddc177a40c7ab71d275de2ac3f8000f3668..8df5fe09ef9bf367a61ab607c27ad7137bb0ddeb 100755 (executable)
@@ -153,15 +153,15 @@ function init_map_on_search_page(is_reverse_search, nominatim_results, request_l
             });
             layerGroup.addLayer(circle);            
         }
-        if (result.aBoundingBox){
+        if (result.boundingbox){
 
-            var bounds = [[result.aBoundingBox[0]*1,result.aBoundingBox[2]*1], [result.aBoundingBox[1]*1,result.aBoundingBox[3]*1]];
+            var bounds = [[result.boundingbox[0]*1,result.boundingbox[2]*1], [result.boundingbox[1]*1,result.boundingbox[3]*1]];
             map.fitBounds(bounds);
 
-            if (result.asgeojson && result.asgeojson.match(/(Polygon)|(Line)/) ){
+            if (result.geojson && result.geojson.type.match(/(Polygon)|(Line)/) ){
 
                 var geojson_layer = L.geoJson(
-                    parse_and_normalize_geojson_string(result.asgeojson),
+                    parse_and_normalize_geojson_string(result.geojson),
                     {
                         // http://leafletjs.com/reference-1.0.3.html#path-option
                         style: function(feature) {
@@ -303,7 +303,6 @@ jQuery(document).ready(function(){
         var api_request_params = {
             q: search_params.get('q'),
             polygon_geojson: search_params.get('polygon_geojson') ? 1 : 0,
-            polygon: search_params.get('polygon'),
             viewbox: search_params.get('viewbox'),
             format: 'jsonv2'
         };
index 479bdd41381d5b4a3cdf9c45b3e2af469247cf83..7f574b0d7ff0a55728a391b9e050259940fdee28 100644 (file)
@@ -6,7 +6,7 @@
         {{/if}}
 
         <span class="name">{{aResult.display_name}}</span>
-        <span class="type">{{formatLabel aResult}}</span>
+        <span class="type">({{formatLabel aResult}})</span>
         <p class="coords">{{aResult.lat}},{{aResult.lon}}</p>  
 
         <a class="btn btn-default btn-xs details" href="details.html?place_id={{aResult.place_id}}">details</a>
@@ -21,7 +21,7 @@
     <div class="form-group search-button-group">
         <button type="submit" class="btn btn-primary btn-sm">Search</button>
         {{#if env.Search_AreaPolygons}}
-            <input type="hidden" value="1" name="polygon" />
+            <input type="hidden" value="1" name="polygon_geojson" />
         {{/if}}
         <input type="hidden" name="viewbox" value="{{sViewBox}}" />
         <div class="checkbox-inline">