aboutsummaryrefslogtreecommitdiff
path: root/resources/op2geojson.js
diff options
context:
space:
mode:
authorKatie Filbert <filbertk@gmail.com>2012-12-01 16:20:21 +0100
committerKatie Filbert <filbertk@gmail.com>2012-12-01 16:20:21 +0100
commit052bb51e2b1a0bdd038a51b1c19849c6b959d3e5 (patch)
tree8c321584e809b4ace481eeb471161411f9f75290 /resources/op2geojson.js
parent41b0fe477b6533acf605f4ba35604a81dc2c5ae3 (diff)
downloadhealth-map-052bb51e2b1a0bdd038a51b1c19849c6b959d3e5.tar
health-map-052bb51e2b1a0bdd038a51b1c19849c6b959d3e5.tar.gz
adding geojson layer
Diffstat (limited to 'resources/op2geojson.js')
-rw-r--r--resources/op2geojson.js50
1 files changed, 50 insertions, 0 deletions
diff --git a/resources/op2geojson.js b/resources/op2geojson.js
new file mode 100644
index 0000000..42aa341
--- /dev/null
+++ b/resources/op2geojson.js
@@ -0,0 +1,50 @@
+( function ( $ ) {
+
+op2geojson = function() {
+
+ var instance = {},
+ geojson;
+
+ instance.fetch = function(url) {
+ $.getJSON("http://overpass-api.de/api/interpreter?data=[out:json];node[amenity=hospital](52.34,13.3,52.52,13.6);out;", {
+ format: "json"
+ },
+ function(data) {
+ $.each(data, function(i, item) {
+ console.log(item);
+ });
+ }
+ );
+ };
+
+ instance.feature = function() {
+ point = {
+ "geometry" : {
+ "type" : "Point",
+ "coordinates" : [52.43,13.45]
+ },
+ "type" : "Feature",
+ "properties" : { "prop0" : "value0" },
+ };
+ return point;
+ }
+
+ instance.featureCollection = function() {
+ collection = {
+ "type" : "FeatureCollection",
+ "features" : [
+ instance.feature(),
+ ]
+ };
+ return collection;
+ }
+
+ instance.geojson = function() {
+ return instance.featureCollection();
+ }
+
+ return instance;
+
+};
+
+})( jQuery );