I have created an array named coordsArray shown beneath. I have cut off the ongoing elements within the arrays as its confidential.
I have this for loop that is supposed to go through each element within the array and look if the coordinates in index values [ 1 ] and [ 2 ] are within a bounding box for London.
var cityL = "ldn";
for (var i = 0; i < coordsArray.drugs.length; i++) {
if(cityL == "ldn"){
if( 51.50408 <= coordsArray.drugs[i][1] && coordsArray.drugs[i][1] <= 51.42548 && -0.326542 <= coordsArray.drugs[i][2] && coordsArray.drugs[i][2] <= 0.0463) {
console.log("test");
}
}
}
This is not working at all, I was wondering if it had something to do with the coordinates within the arrays possibly being of type string? I am unsure as to how I would go about altering this. I am sure that the if statement that checks if the values (coordsArray.drugsi and [2]) are within the bounding box is all correct. Thanks for any guidance, I just wish to view the coordinates that fall within London, thanks!

Aucun commentaire:
Enregistrer un commentaire