[postgis-users] Simplifying a multipolygon layer, keeping polygon connection
Sandro Santilli
strk at keybit.net
Tue Apr 10 03:04:45 PDT 2012
On Mon, Apr 09, 2012 at 07:33:41PM +0200, Nicolas Ribot wrote:
> Hmm much easier with Postgis Topology...
>
> (thanks Brent for the Topology example)
>
> By the way, is it the right way to use topology to simplify a layer ?
It's one way, there may be multiple ones.
Add this new way to to wiki ?
It'd be interesting to see some banchmarks of the two methods you reported.
I'd point out that the toTopoGeom function does the association with you,
directly giving you a TopoGeometry object back. Brent didn't use TopoGeometry
at all, which is legit, but that's the intended mean to associate attributes
to topologically-defined locations.
I've been actually thinking that an ST_Simplify() override taking a
TopoGeometry input might be a good idea. You would be simplifying the same
up to twice each, but the usage would be simper.
--strk;
>
> create table new_dept as (
> select gid, code_dept, (st_dump(geom)).*
> from departement
> );
> create index new_dept_geom_gist on new_dept using gist(geom);
>
> -- create new empty topology structure
> select CreateTopology('topo1',2154,0);
>
> -- add all departements polygons to topology in one operation as a collection
> select ST_CreateTopoGeo('topo1',ST_Collect(geom))
> from departement;
>
> -- create a new topo based on the simplification of existing one
> -- should not be the right way to do it, but calling ST_ChangeEdgeGeom
> failed with a simplify linestring
> select CreateTopology('topo2',2154,0);
>
> select ST_CreateTopoGeo('topo2', geom)
> from (
> select ST_Collect(st_simplifyPreserveTopology(geom, 10000)) as geom
> from topo1.edge_data
> ) as foo;
>
> -- associates new simplified faces with points on surface, in the new_dept table
> alter table new_dept add column simple_geom geometry(POLYGON, 2154);
>
> -- retrieves polygons by comparing surfaces (pip is not enough for
> odd-shaped polygons)
> with simple_face as (
> select st_getFaceGeometry('topo2', face_id) as geom
> from topo2.face
> where face_id > 0
> ) update new_dept d set simple_geom = sf.geom
> from simple_face sf
> where st_intersects(d.geom, sf.geom)
> and st_area(st_intersection(sf.geom, d.geom))/st_area(sf.geom) > 0.5;
>
> Nicolas
>
> On 9 April 2012 01:02, Nicolas Ribot <nicolas.ribot at gmail.com> wrote:
> > For those interested, I've added an entry to the postgis wiki showing
> > an example of polygon layer simplification:
> >
> > http://trac.osgeo.org/postgis/wiki/UsersWikiSimplifyPreserveTopology
> >
> > Nicolas
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
--
,------o-.
| __/ | Delivering high quality PostGIS 2.0 !
| / 2.0 | http://strk.keybit.net - http://vizzuality.com
`-o------'
More information about the postgis-users
mailing list