[postgis-users] PostGIS returns no rows for ST_Intersects

Meherzad Romer mromer at natureserve.ca
Wed Oct 12 20:16:43 PDT 2011


Hi,
I am new to PostGIS, have only been using it for the last couple of weeks.
 I have been using the workshops.opengeo website to learn how to use PostGIS
and am working with the sample NYC database that it came with.  I am trying
to test how the ST_Intersect function works so that I can use it on a real
database, but am not getting any rows returned.
Here's what I did:
1.  I created a polygon in Google Earth that covers the entire NY state and
then, saved it as a KML.
2.  I opened the KML in a text editor used the coordinates to get a geometry
using the ST_GeomFromKML function in PostGIS.  The query looks like this:
SELECT ST_GeomFromKML(' <Polygon>
<outerBoundaryIs>
<LinearRing>
<coordinates>
-75.7218231334201,40.86468238402224,0 -74.91763291540505,39.90090726204763,0
-71.50935163152492,39.85541359103798,0 -71.6577861052406,41.55717566179406,0
-74.71588104333701,41.6603205817405,0 -75.7218231334201,40.86468238402224,0
 </coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>')
;

3.  When I ran it the resulting geometry was:
"01030000A0E6100000010000000600000047E2A75932EE52C0C36690E9AD6E444000000000000000007659687FBABA52C09B9CDDED50F34340000000000000000015E4953799E051C0F1074B317EED434000000000000000006271E42A19EA51C02EC4368851C7444000000000000000005D3DB9FED0AD52C0BFB9836285D44440000000000000000047E2A75932EE52C0C36690E9AD6E44400000000000000000"

4. I copied this into another sql and used the ST_Intersects function, the
query is:
SELECT gid, id, "name", oneway, "type", the_geom
  FROM nyc_streets
  where st_intersects (the_geom,
'01030000A0E6100000010000000600000047E2A75932EE52C0C36690E9AD6E444000000000000000007659687FBABA52C09B9CDDED50F34340000000000000000015E4953799E051C0F1074B317EED434000000000000000006271E42A19EA51C02EC4368851C7444000000000000000005D3DB9FED0AD52C0BFB9836285D44440000000000000000047E2A75932EE52C0C36690E9AD6E44400000000000000000');


5.  I expect to get every single street in the result, however I don't get
any rows returned.

What am I doing wrong?

Please help!

Thanks

Meherzad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20111012/f0a2f73d/attachment.html>


More information about the postgis-users mailing list