Re: identify & compare to a polygonal area? [message #54657] |
Fri, 29 June 2007 11:14 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Josh writes:
> I'm plotting a map of elevation data (by lat/lon coords) over a lake
> and the surrounding land. I would like to identify only those points
> which are over the lake and make use of them. I do not need a level
> of detail that defines the precise shoreline; I was thinking I could
> identify a polygonal area within the lake (it would be concave...
> problem?) and then have a comparison: if the lat and lon are contained
> within the polygon, do something with that data point.
>
> The other important detail is the spacing of these points... there are
> on the order of 30,000 x 3,000 points in the rectangular map grid
> containing this lake. The lake probably fills only 1/8 of the grid,
> but it's diagonal orientation causes it to extend to all sides of that
> 30,000 x 3,000 point window.
Here is an article that describes an IDL algorithm for determining
if a point is inside or outside a polygon:
http://www.dfanning.com/tips/point_in_polygon.html
You don't say how you are drawing your lake, etc., but if
you are using something like the GSHHS Shoreline Database,
obtaining the polygon of the lake should be fairly easy:
http://www.dfanning.com/map_tips/gshhs.html
A low-resolution polygon would probably work for you.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|