[postgis-users] contains syntax

Obe, Regina robe.dnd at cityofboston.gov
Wed Jul 16 04:07:09 PDT 2008


Jo,
Your update syntax should be

UPDATE standorte 
	SET lk = l.lk 
	FROM landkreise as l
WHERE 
ST_Contains(l.the_geom,standorte.the_geom) = TRUE;

Note - your below query is not using indexes.  If you are using Postgis
1.2.1 or above, use the new

ST_Contains instead (that will use indexes since it automagically adds
the && operator)

If you are using older PostGIS, then use

l.the_geom && s.the_geom AND Contains(l.the_geom, s.the_geom)

Hope that helps,
Regina
 

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
jj.wag at gmx.de
Sent: Wednesday, July 16, 2008 6:18 AM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] contains syntax

Hi all,

I have 2 tables:

1. table "landkreise" (polygon) with column "lk" (names of
administrative 
borders (polygons))
2. standorte (point) with column "lk" (empty, I want to write the name
of 
the administrative borders from the polygon-feature that contains the
point)

When I use following select-statement it seems to work:

SELECT l.lk FROM landkreise as l, standorte as s WHERE 
contains(l.the_geom,s.the_geom) = TRUE;

When I want to update the column "lk" in table standorte allways the
same 
name is written:

UPDATE standorte SET lk = l.lk FROM landkreise as l, standorte AS s
WHERE 
contains(l.the_geom,s.the_geom) = TRUE;

What is wrong with my syntax?

Thanks
Jo


_______________________________________________
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.




More information about the postgis-users mailing list