[postgis-users] point in polygon or equivalent

Rhys Stewart rhys.stewart at gmail.com
Fri Dec 30 06:56:52 PST 2005


actually what I wanted (well I did it in pl/pgsql) is given a table
and a point determine which record/polygon contains said point.

the function I created is point_in_polygon(easting, northing, table_name)

@strk I don't know any "real" programming like C or stuff, just enough
PHP & python to see me through the day.




On 12/30/05, strk at refractions.net <strk at refractions.net> wrote:
> 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.
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>



More information about the postgis-users mailing list