silliness, create the geojson object correctly filtering out stops with empty geoms

This commit is contained in:
Sanj 2012-02-20 23:58:23 +05:30
parent d441a5d622
commit d54d281f17

View File

@ -58,12 +58,12 @@ var API_BASE = "/1.0/",
var stops = stopsGeojson.features; var stops = stopsGeojson.features;
var $stopsList = getStopsList(stops); var $stopsList = getStopsList(stops);
var stopsWithGeom = []; var stopsWithGeom = [];
$.each(stopsGeojson.stops, function(i,v) { $.each(stops, function(i,v) {
if (!$.isEmptyObject(v.geometry)) { if (!$.isEmptyObject(v.geometry)) {
stopsWithGeom.push(v); stopsWithGeom.push(v);
} }
}); });
stopsGeojson.stops = stopsWithGeom; stopsGeojson.features = stopsWithGeom;
var currFeatures = jsonLayer.features; var currFeatures = jsonLayer.features;
jsonLayer.removeFeatures(currFeatures); jsonLayer.removeFeatures(currFeatures);
jsonLayer.addFeatures(geojson_format.read(stopsGeojson)); jsonLayer.addFeatures(geojson_format.read(stopsGeojson));