views:

25

answers:

2

Given a database of long/lat coordinates representing targets and a series of lat/long representing the bounding coordinates of polygons representing "zones". Using a simple ray casting algorithm is it safe to treat the lat/long as cartesian coordinates for determining if the target is within the zone?

+1  A: 

Provided the edges are short, it should work well enough. It won't be "correct" though.

Imagine a triangle with two points a and b on the equator and one just short of the north pole. Evidently, (almost) all points with a longitude between a and b above the equator are in the triangle. But if we try treating the lats/longs as cartesian coordinates, we get something quite different...

Edit: You'll need to be careful with zones which cross longitude = max/min, and even more careful with the ones that also contain a pole

dave
how "short" is short enough? A few meters? KM?
Paul Alexander
@Paul Alexander - how accurate do you need to be? Earth is approx 40000km circumference, so if you are talking about 1000km then the curvature of the earth experienced will be under 1 degree. I'd say that's fairly accurate, but it depends on your application.
Kirk Broadhurst
A: 

No, it's not safe to do that. You'll get anomalies around the poles and also at the 0 longitude areas.

Take a look at the NASA world wind code. they have representations for polygons on the surface of the globe although you have to be careful -- some of the representations will represent these anomalies, others will not.

http://worldwind.arc.nasa.gov/java/

Larry Watanabe