[postgis-users] contains syntax

jj.wag at gmx.de jj.wag at gmx.de
Thu Jul 17 03:01:39 PDT 2008


Regina,
thank you very much!
with ST_Contains it works! I was working with an older POSTGIS-Version and 
will update now.

But under the old version this syntax works too:

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

I think it was the "s.the_geom" part
if I write "UPDATE standorte" it must be "standorte.the_geom"

Greetings + thanks
Jo

----- Original Message ----- 
From: "Obe, Regina" <robe.dnd at cityofboston.gov>
To: "PostGIS Users Discussion" <postgis-users at postgis.refractions.net>
Sent: Wednesday, July 16, 2008 1:07 PM
Subject: RE: [postgis-users] contains syntax


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.

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



More information about the postgis-users mailing list