diff options
-rw-r--r-- | resources/map.js | 5 | ||||
-rw-r--r-- | resources/op2geojson.js | 9 |
2 files changed, 5 insertions, 9 deletions
diff --git a/resources/map.js b/resources/map.js index 1909037..91a9432 100644 --- a/resources/map.js +++ b/resources/map.js @@ -34,9 +34,10 @@ $(document).ready(function() { var url = "http://overpass-api.de/api/interpreter?data=[out:json];node[amenity=hospital](" + bbox + ");out;"; converter = new op2geojson(); converter.fetch(url, function(data) { + console.log(data); layer = L.geoJson(data, { onEachFeature: function(feature, layer) { - layer.bindPopup(feature.properties.name); + layer.bindPopup(feature.properties); } }); self.hospitalLayer.addData(data); @@ -53,7 +54,7 @@ $(document).ready(function() { converter.fetch(url, function(data) { layer = L.geoJson(data, { onEachFeature: function(feature, layer) { - layer.bindPopup(feature.properties.name); + layer.bindPopup(JSON.stringify(feature.properties)); } }); self.hospitalLayer = layer; diff --git a/resources/op2geojson.js b/resources/op2geojson.js index ef06c96..74431d3 100644 --- a/resources/op2geojson.js +++ b/resources/op2geojson.js @@ -21,20 +21,15 @@ op2geojson = function() { }; instance.point = function(node) { - var name; - if ( typeof node.tags.name != 'undefined' ) { - name = node.tags.name; - } else { - name = ''; - } var point = { "type" : "Feature", "geometry" : { "type" : "Point", "coordinates" : [node.lon,node.lat] }, - "properties" : { "name" : name }, + "properties" : {} }; + _.extend(point.properties, node.tags); return point; } |