[postgis-users] couldn't manage to update a table containing line geometry

Stephen Woodbridge woodbri at swoodbridge.com
Tue Jul 6 08:38:03 PDT 2010


ahmet temiz wrote:
> hello
> 
> I couldn't manage to update a table containing line geometry.
> I want to update id_no of these line with the polygons' id_no that
> contain these lines.
> 
> something like:
> 
> line id will be polygon id, where polygons contain lines involved.

update line as a set a.id_no=b.id_no from polygons b where a.the_geom 
<relationship> b.the_geom;

Replace <relationship> with the spatial relationship you are interested 
in. This will likely fail if the where clause returns more than one 
record. For example you have two overlapping polygons and both of them 
contain the line you are testing.

-Steve



More information about the postgis-users mailing list