[postgis-users] Spatial Query - Why I cannot select geom as I want?

Willa WEI wwei at mdacorporation.com
Mon Nov 21 09:28:56 PST 2005


Dear PostGISs,
 
I downloaded Postgres 8.1 and loaded some polygon shape files using
shp2postgres tool. Then I followed the instruction to build GIST index
for the geom columns. However, when I tried to use spatial query via
JDBC to select polygons, I couldn't select any polygon with spatial
query. Here are the ways I did:
 
First, I use the sample code in the user manual to select polygons from
the geo table and print the geometries. then, I pick up one point from
the screen to use it as the geospatial reference for the queries.
 
Query 1, I used the reference point as the center point to make it as
polygon. then submitted the query as follow:
WHERE the_geom && GeomFromText('POLYGON((-117.05338168844499
33.0161157574187, -117.05338168844499 33.0191157574187,
-117.050381688445 33.0191157574187, -117.050381688445 33.0161157574187,
-117.05338168844499 33.0161157574187))',-1)

The query result set returned  0 row.
 
Query 2, I used the reference point to make a bounding box and submitted
the spatial query as BOX3D.
The result set still contained 0 row.

Query 3, I used reference point and composed a query as  distance from
the point. Still, I got 0 row when queried a small table and Jave out of
memory error when queried a large table (900,000 rows).

Is there anybody who knows what is the problem?  I used postgres query
tool to create the GIST index and Maintenance tool to VACUUM and Analyze
the table (the comand VACUUM on the column didn't work). I checked the
index in the database, it is there. What else could be go wrong in my
procedures?

 

Thanks in advance for your help,

Willa

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20051121/4895d373/attachment.html>


More information about the postgis-users mailing list