[postgis-users] ST_CreateTopoGeo

paul.malm at lfv.se paul.malm at lfv.se
Tue Mar 3 06:30:11 PST 2020


Hi,
I'm not sure of what you mean, Strk.
I create a topology (topo1) with all geometries from a polygon layer.
I can see the island and the Egypt polygon in the edge_data, they are not intersecting.

Then I create a new topology (topo2) with:
select topology.ST_CreateTopoGeo('topo2', the_geom) from ( 
       select ST_Collect(st_simplifyPreserveTopology(geom, 5000)) as the_geom
       from topo1.edge_data) as foo;

Here in the topo2.edge.data I can see that the island and the polygon of Egypt is intersecting due to the simplifying.
And when I create a new polygon layer from this edge_data the Egypt polygon is left out.

This is done with:
with simple_face as ( select topology.st_getFaceGeometry('topo2', face_id) as the_geom 
       from topo2.face 
       where face_id > 0 ) update newlayer d set geom = sf.the_geom 
from simple_face sf 
where st_intersects(d.geom, sf.the_geom)
st_area(st_intersection(sf.the_geom, d.geom))/st_area(sf.the_geom) > 0.5";

Kind regards,
Paul

-----Ursprungligt meddelande-----
Från: strk at kbt.io [mailto:strk at kbt.io] 
Skickat: den 3 mars 2020 10:27
Till: Malm, Paul (Operations AIM)
Kopia: postgis-users at lists.osgeo.org
Ämne: Re: SV: [postgis-users] ST_CreateTopoGeo

On Fri, Feb 28, 2020 at 12:29:49PM +0000, paul.malm at lfv.se wrote:
> Hi again,
> I can see in the edge data of topo2 that the main polygon of Egypt intersects with an island next to the main polygon. If I delete the island in the original layer before running the SQL sequence the main polygon of Egypt is included in the result layer. Is there any solution of this problem?

The above (being unable to include Egypt when island is added) still
depends on the tolerance value, right ? There's probably a spatial
configuration between those 2 polygons that triggers an excessive
snapping with high tolerances. Keep your tolerances low!

Or, insert the island in the topology as the last thing, and see
where the error ends up being (the whole point of building the
topology incrementally rather than in a single step is to be able
to deal with each case separately, and spot what's special about it)

--strk;


More information about the postgis-users mailing list