[postgis-users] Help with query

mark balman mark.balman at gmail.com
Tue Mar 10 04:04:02 PDT 2009


Hi all

I am trying to create a query that returns the features intersected by a
user defined area. I can do this with the following query which works fine
and returns what I want:

select areaname, country
FROM pas_nat_iv_pnt
where ST_Intersects(pas_nat_iv_pnt.the_geom ,
ST_GeomFromText('POLYGON((-7726647.392661 408830.119563 ,
-6918290.736304  408830.119563 , -6918290.736304  828801.112346 ,
-7726647.392661  828801.112346 , -7726647.392661 408830.119563 ))' , 32662)
)

However, what I need to do is to have a user enter latitude and longitude
values and then transform these into Plate Carree coordinates, I have tried
the following query:

select areaname, country
FROM pas_nat_iv_pnt
where  ST_Intersects(pas_nat_iv_pnt.the_geom ,
transform(ST_GeomFromText('POLYGON((-7726647.392661 408830.119563 ,
-6918290.736304  408830.119563 , -6918290.736304  828801.112346 ,
-7726647.392661  828801.112346 , -7726647.392661 408830.119563 ))' ,
32662),4326))

The query runs but returns no rows.. I would be most grateful if anyone
could enlighten me on what is wrong and what I need to change.

TIA

Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20090310/0e13d5fc/attachment.html>


More information about the postgis-users mailing list