I am working with an array named coordinate
that contains latitude and longitude values for a polygon. I am trying to find the maximum and minimum latitude/longitude stored in this array.
My approach involves using the array.filter()
method to filter the values, but I keep encountering the following error in my console:
coordinate.filter is not a function
// To extract latitude and longitude values of a map and store them in an array named coordinate
var coordinate = [];
for (var i = 0; i < polygon.getPath().getLength(); i++) {
coordinate += polygon.getPath().getAt(i).toUrlValue(6) + ",";
}
var results = coordinate.filter(function(value) {
return (value < 0);
});
alert(coordinate);
})