Or the more succinct and modern

SELECT the_geom, zone
FROM r_zones
WHERE
ST_Contains(the_geom,GeomFromText('POINT(7644373.465626 687692.342075)', 2838));


On 25-Jan-08, at 8:14 PM, Stephen Woodbridge wrote:

Try:

SELECT the_geom, zone
  FROM r_zones
 WHERE
   setsrid(makepoint(7644373.465626, 687692.342075), 2838) && the_geom
and within(setsrid(makepoint(7644373.465626, 687692.342075), 2838), the_geom);

Now this assumes that the_geom of r_zones is also in srid 2838. If not you will need to project the point into whatever srid that r_zones is in.

HTH,
 -Stephen Woodbridge
  http://imaptools.com/

Thomas Crosslin wrote:
I’m a new PostGIS/PostgreSQL user.
I’ve successfully set up my database and uploaded a few shapefiles to play with.
I want to do some spatial queries and I’m having some difficulty.
I’d like to extract the polygon that a point intersects – actually I really want to be able to intersect several layers at once with a given point and return the values from a particular field from each layer. But I decided to start with one layer. So the table is called “r_zones” (it is an imported shapefile) and the field I want information returned from is called “zone”. So what I want is to know what “zone” the point falls within. I’m using PgAdmin (v1.6.2) to query my database, Windows, Postgres8.2, PostGIS 1.3.1.
 So I’ve tried a basic query like this:
 SELECT the_geom, zone
FROM r_zones
WHERE GeomFromText('POINT(7644373.465626 687692.342075)', 2838)
I know the WHERE statement is incorrect, I’ve tried several variants looking at the docs (like using a distance based query and others) but cannot make a successful query. Where am I going wrong?
  Any help appreciated.
 -Thomas
--------------------------------------------------------------------- ---
_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to