Determining whether geographic point is within X meters of a state border (using shapefile for borde

Posted by DanM on Stack Overflow See other posts from Stack Overflow or by DanM
Published on 2009-05-27T19:08:42Z Indexed on 2010/05/08 13:18 UTC
Read the original article Hit count: 364

Filed under:
|
|
|
|

So I'm writing a Java app, and I've got an ESRI Shapefile which contains the borders of all the U.S. states. What I need is to be able to determine whether any given lat/lon point is within a specified distance from ANY state border line - i.e., I will not be specifying a particular border line, just need to see whether the point is close to any of them.

The solution does NOT have to be very precise at all; e.g. I don't need to be dealing with measuring perpendicular to the border, or whatever. Just checking to see if going X meters north, south, east or west would result in crossing a border would be more than sufficient. The solution DOES have to be computationally efficient, as I'll be performing a huge number of these calculations.

I'm planning to use the GeoTools library (though if there's a simpler option, I'm all for it) with the Shapefile plugin. What I don't really understand is: Once I've got the shapefile loaded into memory, how do I check to see whether I'm near a border?

Thanks! -Dan

© Stack Overflow or respective owner

Related posts about geospatial

Related posts about geography