<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2604" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><SPAN class=872265717-21112005><FONT face=Arial color=#0000ff size=2>Why is
the spatial reference -1 for your GeomFromText() constructor? What is the SRID
for the table you are querying? Are you sure they contain the same
units?</FONT></SPAN></DIV>
<DIV><SPAN class=872265717-21112005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=872265717-21112005><FONT face=Arial color=#0000ff
size=2>-e</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT
face=Tahoma size=2>-----Original Message-----<BR><B>From:</B>
postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of
</B>Willa WEI<BR><B>Sent:</B> Monday, November 21, 2005 10:29 AM<BR><B>To:</B>
postgis-users@postgis.refractions.net<BR><B>Subject:</B> [postgis-users]
Spatial Query - Why I cannot select geom as I want?<BR><BR></FONT></DIV>
<DIV dir=ltr align=left>
<DIV><FONT face=Arial size=2><SPAN class=593100618-18112005>Dear
PostGISs,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=593100618-18112005></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=593100618-18112005>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:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=593100618-18112005></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=593100618-18112005>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.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=593100618-18112005></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=593100618-18112005>
<DIV><FONT face=Arial size=2><SPAN class=593100618-18112005>Query 1, I used
the reference point as the center point to make it as polygon. then
submitted the query as follow:</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff>
<P><FONT size=2>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)</FONT></P></FONT></DIV></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=593100618-18112005><SPAN
class=593100618-18112005>The query result set<SPAN class=004220017-21112005>
returned</SPAN> 0 row.</SPAN></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=593100618-18112005><SPAN
class=593100618-18112005></SPAN></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=593100618-18112005>Query 2, I used
the reference point to make a bounding box and submitted the spatial query as
BOX3D.</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff><SPAN class=593100618-18112005><FONT face=Arial
color=#000000 size=2>The result set still contained 0 row.</FONT></SPAN></DIV>
<DIV>
<P><SPAN class=593100618-18112005><FONT face=Arial><FONT color=#000000><FONT
size=2>Query 3, I used reference point and composed a query as
distance from the point. Still, I got 0 row<SPAN class=004220017-21112005>
when queried a small table and Jave out of memory error when queried a large
table (900,000 rows).</SPAN></FONT></FONT></FONT></SPAN></P>
<P><SPAN class=593100618-18112005><FONT face=Arial color=#000000
size=2>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 <SPAN class=004220017-21112005>table (the comand VACUUM
on the column didn't work)</SPAN>. I checked the index in the database, it is
there. What else could be go wrong in my procedures?</FONT></SPAN></P>
<P><SPAN class=593100618-18112005><FONT face=Arial color=#000000
size=2></FONT></SPAN> </P>
<P><SPAN class=593100618-18112005><FONT face=Arial color=#000000 size=2>Thanks
in advance for your help,</FONT></SPAN></P>
<P><SPAN class=593100618-18112005><FONT face=Arial color=#000000
size=2>Willa</FONT></SPAN></P></DIV></FONT></DIV><FONT color=#0000ff>
<DIV>
<P><SPAN class=593100618-18112005><FONT face=Arial color=#000000
size=2></FONT></SPAN> </P></FONT></DIV></BLOCKQUOTE></BODY></HTML>