I have a list of 900-1000 longitude/latitude coordinates. I know and can depend that these coordinates form a rough rectangle. Is there a formula to determine which coordinates are at the corners (NW, NE, SE, SW)?
Is it correct to say that:
- the coordinate with the largest lat and smallest long is the most NW?
and thus
- the smallest lat and largest long is the SE corner?
- the smallest lat and smallest long is the SW corner?
- the largest lat and largest long is the NE corner?
The points I am dealing with are gathered by a drone flying a rectangular area approximately 100 sq meters. It crosses the entire included area of the rectangle in rows columns type fashion (snaking back and forth) and could start in the middle of the rectangle or at a corner or anywhere within the area.
Here is what I ended up with, if all corners are right angles you can look at lat/long in same if/then statement but if it is trapezoidal (non rect or square) you have to check the lat/long in separate if/thens
let NW = {
name:"NW",
lat:-90,
long:180
};
let NE = {
name:"NE",
lat:-90,
long:-180
};
let SW = {
name:"SW",
lat:90,
long:180
};
let SE = {
name:"SE",
lat:90,
long:-180
};
imggps.forEach((img)=>{
// the coordinate with the largest
// lat and smallest long is the most NW?
if(img.lat > NW.lat){
NW.lat = img.lat;
}
if(img.long < NW.long){
NW.long = img.long;
}
// the largest lat and largest
// long is the NE corner?
if(img.lat > NE.lat){
NE.lat = img.lat;
}
if(img.long > NE.long){
NE.long = img.long;
}
// the smallest lat and smallest
// long is the SW corner?
if(img.lat < SW.lat){
SW.lat = img.lat;
}
if(img.long < SW.long){
SW.long = img.long;
}
// the smallest lat and largest
// long is the SE corner?
if(img.long > SE.long){
SE.long = img.long;
}
if(img.lat < SE.lat){
SE.lat = img.lat;
}
});
-180.0 - 180.0
(W-E) Lon and-90.0 - 90.0
(S-N) Lat, so your assumptions are correct no matter where.27.79668 lat
-82.33275 long
is in the middle or Florida, United States - so I was thinking if I go North the lat gets higher and if I go West long gets smaller (more negative). So using that frame of reference, NW would be the largest lat and smallest long right?