From 79da7715975b3b86251a8ee0f3373a440f860aba Mon Sep 17 00:00:00 2001 From: "didier.amyot" Date: Fri, 16 May 2014 18:22:53 -0400 Subject: [PATCH] better all on maps. --- client/coffee/controllers/geojsonmapCtrl.coffee | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/client/coffee/controllers/geojsonmapCtrl.coffee b/client/coffee/controllers/geojsonmapCtrl.coffee index 3c5c6c3..9bbf1d3 100644 --- a/client/coffee/controllers/geojsonmapCtrl.coffee +++ b/client/coffee/controllers/geojsonmapCtrl.coffee @@ -1,9 +1,14 @@ root = this; + + + mapCenter = lat: 46.1227 lng: -72.6169 zoom: 7 + + getSingleDataUrl = (routeParams) -> url = "/api/#{ routeParams.server }/#{ routeParams.database }/#{ routeParams.collection }" if routeParams.query @@ -21,14 +26,19 @@ getDocumentUrl = (routeParams, id) -> transformListOfGeoJsonToGeometryCollection = (resData, routeParams) -> ret = - type: "GeometryCollection" - geometries: [] + type: "FeatureCollection" + features: [] for doc in resData.document geojson = doc[routeParams.key] if not geojson.properties geojson.properties = {} geojson.properties["_vulture_url_link"] = getDocumentUrl(routeParams, doc._id) - ret.geometries.push(geojson) + feature = + type: "Feature" + geometry: geojson, + properties: + "_vulture_url_link": getDocumentUrl(routeParams, doc._id) + ret.features.push(geojson) return ret