geojson - mapbox number of items returned by getJSON -
i placing multiple clustered locations on map. how can retrieve number of total of featured returned?
here code:
<script>  $.getjson("datafile.json", function(data) {      var geojson = l.geojson(data, {        oneachfeature: function (feature, layer) {          layer.seticon(l.mapbox.marker.icon({'marker-symbol': 'circle-stroked', 'marker-color': '59245f'}));  		var popup="pouptext";          layer.bindpopup(popup,{          closebutton: true,          minwidth: 320      });        }      });      markers.addlayer(geojson);  	var map = l.mapbox.map('map', 'mapbox.streets') .setview([42, -90], 4);      baselayer.addto(map);      markers.addto(map);    });  </script>thanks.
assuming datafile.json contains geojson featurecollection, number of features stored in data.features.length property.
Comments
Post a Comment