[postgis-users] Help with query
Obe, Regina
robe.dnd at cityofboston.gov
Tue Mar 10 05:16:40 PDT 2009
Mark,
I'm a bit confused, for your second query, are those points suppose to
represent user input and in long lat? They don't look like long lat.
If they are meant to be long lat, then your args are just backwards.
The basic idea I think you want to do is
1) Take user input which I presume is in 4326 and then transform it to
Plate Carree to match your existing data?
Note ST_GeomFromText doesn't transform anything it simply states this
data is in long lat and then transform changes the coordinates to Plate
Carree
So should be
ST_Intersects(pas_nat_iv_pnt.the_geom
,ST_Transform(ST_GeomFromText(userinput,4326), 32662) )
Hope that helps,
Regina
________________________________
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of mark
balman
Sent: Tuesday, March 10, 2009 7:04 AM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] Help with query
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
-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20090310/0d721d11/attachment.html>
More information about the postgis-users
mailing list