[postgis-users] Topology: Simplifying Coastlines with Islands

Sandro Santilli strk at keybit.net
Fri May 25 13:28:59 PDT 2012


On Fri, May 25, 2012 at 06:36:39PM +0200, Michiel J. van Heek wrote:
> Dear list,
> 
> I am trying to simplify a dataset of country boundaries by using
> topology functions, as described in Strk's Blog: http://strk.keybit.net/blog/2012/04/13/simplifying-a-map-layer-using-postgis-topology/
> 
> This has worked quite well, except for coastlines with islands
> nearby. The simplified coastline would probably intersect the
> island, or pass the island at the wrong side, leading to invalid
> topology. Does that mean that countries with coastal islands such as
> Canada and Norway (see attached image) cannot be simplified this
> way?

I think you should figure out more about why the simplification
fails. The function in the post raises a WARNING on each failure,
what does that warning say ? I'm asking because there's also the
case of self-topology breakage, which could be prevented by using
ST_SimplifyPreserveTopology rather than ST_Simplify. 

If your assumption about why simplification fails is correct you
could make things better by splitting the complex edge near the
islands (see ST_ModEdgeSplit).

> Ideally, islands in the way of a to-be-simplified coastline should
> be merged with the mainland. (I have already removed the smaller
> islands, but I think I should not remove the bigger islands too.)

The function in the post is still only considering each edge in
turn and has no knowledge of which faces are defined by those
edges, let alone which faces define your feature (mainland, island).
You'll need something more sofisticated for that, and I'm not sure
there's an easy general handling for such cases. I mean, there could
still be the case in which simplifying an edge would intersect an
island which doesn't belong to the same feature...

Let me know what you found when looking closer at the failure messages.
There's a ticket to make those messages more useful to understand
the problem [1], if you hit that please add to that ticket, and maybe
provide also a patch :)

[1] http://trac.osgeo.org/postgis/ticket/1817

Finally: make sure to run the latest and greatest postgis & GEOS.
There have been a few fixes and improvements lately.

--strk;

  ,------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