[postgis-users] Help with query

Obe, Regina robe.dnd at cityofboston.gov
Tue Mar 10 06:43:58 PDT 2009


Yes.  Expect one is all I can say, but not at liberty to talk about the
details right now.

________________________________

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 9:38 AM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Help with query


Hi Regina
 
Many thanks to your prompt answer, the query works great now! In my
query the coordinates were in Plate Carree metres and I think I confused
myself with the transform function. Much appreciated, any news on the
proposed postgis book?
 
Cheers
 
Mark

On Tue, Mar 10, 2009 at 12:16 PM, Obe, Regina
<robe.dnd at cityofboston.gov> wrote:


	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. 

	

	
________________________________


	

	Help make the earth a greener place. If at all possible resist
printing this email and join us in saving paper. 

	


	_______________________________________________
	postgis-users mailing list
	postgis-users at postgis.refractions.net
	http://postgis.refractions.net/mailman/listinfo/postgis-users
	
	

	




-----------------------------------------
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/8813cdec/attachment.html>


More information about the postgis-users mailing list