[postgis-users] Query postGIS (ArcGIS shapefile) based on lat/lon position

Stephen Woodbridge woodbri at swoodbridge.com
Tue Jun 14 06:01:46 PDT 2005


Courtney,

Try something like:

select the_geom from table where intersects( GeomFromText('POINT(long, 
lat)', -1), the_geom);

this is the basics, if you have a large table you might want to precede 
the intersects() with:

GeomFromText('POINT(long, lat)', -1) && the_geom and

Which intersects the bboxes of the objects first which rejects most of 
the_geom first based on the bbox overlaps and only does the expensive 
intersects() function on a few objects.

-Steve W.

Greene, Courtney wrote:
> Hi,
> I'm a new user of postgres/postGIS, (Win2000, postgres 8.0.3, postGIS 
> 9.0.1) but I have managed to load the contents of an ArcGIS shapefile 
> into postGIS and I'm able to query and retrieve records based on the 
> table contents.
> 
> What I'm struggling with is trying to formulate and execute a query 
> based on a latitude/longitude position. I want to query and retrieve the 
> one record that describes the shape that is positioned over a specific 
> lat/lon position and I just don't know how to work with a lat/long 
> position and the positions as described in the shape file. Can any one 
> offer any suggestions as to how I can do this or where I may look for 
> answers?
> 
> I appreciate any guidance that may be offered.
> 
> Thanks,
> Courtney
> 
> Courtney Greene
> Defence R&D Canada - Atlantic
> Integrated Signatures Management
> 9 Grove Street (PO Box 1012)
> Dartmouth, Nova Scotia
> Tel: 902-426-3100, Ext. 258
> Email: Courtney.Greene at drdc-rddc.gc.ca
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> 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