<!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.2769" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff
size=2></FONT> </DIV>
<DIV dir=ltr align=left><SPAN class=862040219-21112005><FONT face=Arial
color=#0000ff size=2>I checked the SRID as you suggested and it is -1. So, the
query and table are in the same units. Is there anything else I could do to make
it work?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=862040219-21112005><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=862040219-21112005><FONT face=Arial
color=#0000ff size=2>Thanks,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=862040219-21112005><FONT face=Arial
color=#0000ff size=2>Willa</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B>
postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of </B>Ethan
Alpert<BR><B>Sent:</B> Monday, November 21, 2005 10:41 AM<BR><B>To:</B> PostGIS
Users Discussion<BR><B>Subject:</B> RE: [postgis-users] Spatial Query - Why I
cannot select geom as Iwant?<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><SPAN class=947063918-21112005><FONT face=Arial color=#0000ff size=2>To
check the SRID of any table's geometry do:</FONT></SPAN></DIV>
<DIV><SPAN class=947063918-21112005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=947063918-21112005><FONT face=Arial color=#0000ff
size=2>select SRID from geometry_columns where f_table_name =
'<your_table_name>'</FONT></SPAN></DIV>
<DIV><SPAN class=947063918-21112005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=947063918-21112005><FONT face=Arial color=#0000ff
size=2>Perhaps you can post the output of:</FONT></SPAN></DIV>
<DIV><SPAN class=947063918-21112005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=947063918-21112005><FONT face=Arial color=#0000ff size=2>\d
<your_table_name></FONT></SPAN></DIV>
<DIV><SPAN class=947063918-21112005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=947063918-21112005><FONT face=Arial color=#0000ff size=2>When
the table was loaded there should be constraints wrt to SRID which you can see
with \d. \d will also show the indexes</FONT></SPAN></DIV>
<DIV><SPAN class=947063918-21112005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=947063918-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 11:25 AM<BR><B>To:</B>
PostGIS Users Discussion<BR><B>Subject:</B> RE: [postgis-users] Spatial Query
- Why I cannot select geom as Iwant?<BR><BR></FONT></DIV>
<DIV dir=ltr align=left><SPAN class=601361618-21112005><FONT face=Arial
color=#0000ff size=2>Hi Ethan,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=601361618-21112005><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=601361618-21112005><FONT face=Arial
color=#0000ff size=2>Thanks for your replying.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=601361618-21112005><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=601361618-21112005><FONT face=Arial
color=#0000ff size=2>I used the spatial reference - 1 because I don't want to
specify any SRID. The spatial reference in the original shape file
is WGS84 and I picked up the point from the query output from the sample
table. So, they should have the same units. I forgot the mentioned in my
original email. I tried the queries without SRID and they didn't work
either. </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=601361618-21112005><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=601361618-21112005><FONT face=Arial
color=#0000ff size=2>By the way, do you know how to check SRID after loading
of a shape file?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=601361618-21112005><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=601361618-21112005><FONT face=Arial
color=#0000ff size=2>Willa</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B>
postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of
</B>Ethan Alpert<BR><B>Sent:</B> Monday, November 21, 2005 10:06
AM<BR><B>To:</B> PostGIS Users Discussion<BR><B>Subject:</B> RE:
[postgis-users] Spatial Query - Why I cannot select geom as
Iwant?<BR></FONT><BR></DIV>
<DIV></DIV>
<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></BLOCKQUOTE></BODY></HTML>