Last active
March 22, 2016 18:06
-
-
Save roma0104/b50d62ad6fdb7440f8c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Enter file contents hereif (type === 'circle') { // Make a strict comparison, no false positives | |
var test = []; | |
var theCenterPt = layer.getLatLng(); | |
var theRadius = layer.getRadius(); | |
var counter_points_in_circle = 0; | |
// Loop through each point in GeoJSON file //var allPoints = L.geoJson(data); | |
allPoints.eachLayer(function (layer) { // already in scope from lines before, try something else | |
var theLayer = layer; // unused variable | |
// Lat, long of current point | |
layer_lat_long = layer.getLatLng(); | |
// Distance from our circle marker To current point in meters | |
distance_from_centerPoint = layer_lat_long.distanceTo(theCenterPt); | |
// See if meters is within radius | |
if (distance_from_centerPoint <= theRadius) { | |
counter_points_in_circle += 1; | |
test.push.layer; //Try pushing the new argument or theLayer | |
} | |
}); | |
alert(counter_points_in_circle); //Works. | |
alert(test.features.length); //test.features is undefined.. | |
alert("results "+JSON.stringify(test)); //results [] | |
alert("results "+JSON.stringify(test.toGeoJSON())); //test.toGeoJSON is not a function | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment