[postgis-users] Test a point in a geomety...

David Blasby dblasby at refractions.net
Wed Jun 11 13:45:36 PDT 2003

> SELECT name from airport_tbl where
> truly_inside(the_geom,GeomtryAsText('BOX3D( -99 50.2, -99 50.2)',-1)) =
> true;

Dont you use truly_inside! I'm going to delete it from postGIS so noone 
ever uses it again.

You can use:
SELECT  name FROM airport_tbl WHERE the_geom && GeomtryAsText('POINT(-99 
50.2)',-1)) and distance(the_Geom,GeomtryAsText('POINT(-99 50.2)',-1))) ==0;

This uses the spatial index, so it should be fast.

NOTE: if the point is very very close to the boundary, the distance() 
function may not return 0.

If you are using the GEOS enhanced postgis, you can do this calculation 
robustly with the contains() function.

> It would be great if someone would teach a class on just creating effective
> queries on PostGIS. There's so much
> that you can do with it.

Yes - I'd love to write more documentation and examples for postGIS, but 
I dont have the time.  Does anyone out there have time?


More information about the postgis-users mailing list