[postgis-users] Adjecent Polygons to lines, typology related

Peter webwiz at pl.net
Thu Mar 22 16:17:00 PDT 2012


Regarding extracting adjacent polygon common edges, my objectives are threefold:
- by rendering the poly as a line reduce rendering time
- generalised without conflicting with its neighbour
- optionally not render the non shared line, ie the perimeter

Ive been trying to get Paul Ramseys tip as here to work.:
http://gis.stackexchange.com/questions/178/simplifying-adjacent-polygons#705
The crux of which is:

CREATE TABLE rings AS SELECT (ST_DumpRings(the_geom)).geom AS the_geom FROM polys;
CREATE TABLE simplerings AS SELECT ST_Union(the_geom) AS the_geomFROM rings;
CREATE TABLE newpolycollection AS SELECT ST_Polygonize(ST_Simplify(the_geom, 10.0)) AS the_geom FROM simplerings;

He says there are errors and i believe there are two, the first being that the linestring conversion is missing. You can do this with either st_boundary or st_exteriorring. eg:

CREATE TABLE rings AS SELECT (ST_DumpRings(the_geom)).geom AS the_geom FROM polys;
CREATE TABLE ringlines AS SELECT ST_boundary(the_geom) AS the_geom FROM rings;
CREATE TABLE simplerings AS SELECT ST_Union(the_geom) AS the_geom FROM ringlines;

The next problem is that st_union:
- usually breaks the linestring into indiv line segments
- but only sometimes, im guessing when the direction is not the same
- takes much time, 10 minutes for 16 relatively small features (NZ regions)

The principle is also described here:
http://postgis.refractions.net/pipermail/postgis-users/2008-March/018778.html
Which is what leads me to suspect that line direction is likely the key.

Its a pity that st_intersection cant work on sets then it could be used to return linestrings where adjacent polygons intersect. Probably slow though.

Am i wasting time working on this or should i wait for postgis 2.0?
If the latter is their a topology primer somewhere?

Peter



More information about the postgis-users mailing list