From 027e9de06e83eb5c04866ecef16e8ee323f9ee9c Mon Sep 17 00:00:00 2001 From: Yuval Adam Date: Mon, 14 Jan 2013 22:06:52 +0200 Subject: Drop all markers on map, it's heavy --- cities.json | 2 +- index.html | 24 +++++++++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/cities.json b/cities.json index 6cb8901..7d82cdb 100644 --- a/cities.json +++ b/cities.json @@ -1,4 +1,4 @@ -{ +cities = { "": { "status": "ZERO_RESULTS", "results": [] diff --git a/index.html b/index.html index 61a1dfd..2f403a5 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,9 @@ Elections 2013 Map - + + +

Elections 2013 Map

@@ -19,14 +21,18 @@ map.addLayer(markerLayer); map.centerzoom({lat: 31.54, lon: 35.23}, 7); - markerLayer.add_feature({ - geometry: { coordinates: [35.2, 31.5] }, - properties: { - 'marker-color': '#000', - 'marker-symbol': 'star-stroked', - title: 'Example Marker', - description: 'This is a single marker.' - } + _.each(cities, function(v, k){ + if (v.status == "OK") { + var location = v.results[0].geometry.location; + markerLayer.add_feature({ + geometry: { coordinates: [location.lng, location.lat] }, + properties: { + // 'marker-color': '#000', + // 'marker-symbol': 'star-stroked', + title: k + } + }); + }; }); -- cgit v1.3.1