[postgis-users] point in polygon or equivalent
strk at refractions.net
strk at refractions.net
Fri Dec 30 06:19:44 PST 2005
On Fri, Dec 30, 2005 at 04:21:21PM +1100, Rhys Stewart wrote:
> Greetings,
>
> Is there already a way to determine which polygon a certain point
> falls in? Just want to know berfore I start to write a function.
``within(point, polygon)'' is what you're looking for.
``distance(point, polygon) == 0'' could be faster for some cases.
Remember to add ``point && polygon'' to improve performance by
use of the spatial index (if defined).
If you're still willing to code (I hope so) and really
want a faster solution check the pt_in_poly_2d() function
in lwgeom/measures.c.
The function could be invoked as a short-cut when input
to within() are Area/Point, but since within() would be
robust I'm not sure this is the way to go...
--strk;
/"\ ASCII Ribbon Campaign
\ / Respect for low technology.
X Keep e-mail messages readable by any computer system.
/ \ Keep it ASCII.
More information about the postgis-users
mailing list