[postgis-users] Select polygons within polygon with PostGIS 2.0

Sandro Santilli strk at keybit.net
Tue Oct 16 00:17:14 PDT 2012


On Tue, Oct 16, 2012 at 06:02:19AM +0000, Astrid Bjørnerød wrote:
> But has the TopoGeometry object  id from the geometry ?

The TopoGeometry object does NOT have an identifier of your feature.
But you can put a TopoGeometry value into a column of your features table,
thus building the link you're looking for.

The tipical way to retain that link I often use is:

  UPDATE feature_table SET the_topogeom = toTopoGeom(the_geom, ...)

That way each record in the "feature_table" encodes the relation between
the feature attributes and the simple _and_ topologically defined shape.

> And the same with TopoElements, they only have element-id and type.

Right, because TopoElements are just a mean to describe the composition
of a TopoGeometry.

> I want to delete  edges which left or right face has a special
> attributevalue, for building new topology without these edges and the
> update the geometry.

User attributes are not directly associated with faces, but you can
associate them with TopoGeometry objects by relating them in a table.

> Then I have to know the answer from a query like this:
> Select edge_id from topo.edge where topo.edge.left_face = select  g. GetTopoGeomElements.element_id from geoTable g where g.field1 = 'value1';
> Is this possible?

If I understand correctly you're asking for the list of edges that have
any of the faces defining a given TopoGeometry on the left. Correct ?
In that case yes, you should be able to do that.

A possible query could be:

 SELECT e.edge_id FROM topo.edge e
 WHERE e.left_face IN (
   SELECT (GetTopoGeomElements(topogeom))[1]
   FROM "geoTable"
   WHERE field1 = 'value1'
 )

--strk;

 http://www.cartodb.com - Map, analyze and build applications with your data

                                       ~~ http://strk.keybit.net 




More information about the postgis-users mailing list