I am getting coordinates - lat/lon and I want to check if these coordinates are in the continental United States or not. Is there a easy way to do it in C#? I can convert the coordinates into MGRS or UTM. Thanks!
Oh wow, they have it just for you:
http://econym.org.uk/gmap/states.xml
All the coords of the US states! Build up a polygon and apply any polygon-contains-point algorithm.
The classic algorithm is ray-casting, and its even pretty simple. Let me know if you have any trouble with it.
Now, you have two options:
However, there is a problem with that approach - I don't know how the data was gathered, but its possible that there are very little gaps between states, or even slight overlaps. So if you only care if its generally in the US or not, I suggest the second approach:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With