[postgis-users] line simplication

strk strk at freek.keybit.net
Thu Feb 27 09:03:47 PST 2003

I've implemented the Douglas-Peuker algorithm for
vector simplification as a postgres stored procedure.

As we discussed some time ago it has the known problems
of messing with intersections (like country borders).

Nontheless I've given it a life so we can see with our
eyes the claimed problems (at least this it why I finally
did it after months of procrastination).

I'd like to receive feedback about some issues:

   1: Some polygon rings reduce to a single point or line (2 or 3 points).

   2: Some lines reduce to a single point (1 point).

   3: Points are untouched.

   When encountering these cases what should the function do ?

   It could:
      - skip all geometries of this type eventually returning a NULL geometry.
      - skip all but the first geometry to avoid NULL returns.
      - keep all geometries.


   the module is available at:


pramsey wrote:
> There should be lots of examples in the source for prospective 
> developers of this. Check the length functions for examples of using 
> vertices from features, and check the constructor functions for example 
> of returning geometries as a function result. Given that info, some C 
> knowledge, and a paper on D-P, you should be off to the races.
> P.
> strk wrote:
> > I think postgis should do this. I'd like helping with it.
> > 
> > For the sorrouding environment problem:
> > 
> > "The use of spatial context in linear feature simplification"
> > http://www.geovista.psu.edu/sites/geocomp99/Gc99/020/gc_020.htm
> > 
> > --strk;
> > 
> > andy wrote:
> > 
> >>Douglas Peucker is a useful algorithm, but you need to be careful with
> >>it in a mapping setting. The algorithm basically removes points from a
> >>linestring that don't change it too much.
> >>
> >>The problem is that the algorithm has no knowledge of the surrounding
> >>environment. Intersections are a good example. If you have a normal
> >>intersection of two street segments, moving the point of intersection a
> >>little doesn't harm the map much.
> >>
> >>However, D-P may take T-intersection and transform it either into two
> >>disconnected lines or two lines that cross each other. Neither of these
> >>looks correct visually and may cause other problems in interpretation.
> >>
> >>Also, D-P operates in a cartesian space and applying it to raw lat/lon
> >>data probably wouldn't work right.
> >>
> >>On Mon, 2003-01-06 at 16:47, Paul Ramsey wrote:
> >>
> >>>Precisely correct (I think). The best way to the desired result should 
> >>>be to implement a Douglas simplification function, and then create a 
> >>>view which (a) uses attributes to reduce to just the features of 
> >>>interest (interstates, etc) and (b) uses the simplify() function to 
> >>>remove unnecessary vertices from the features.
> >>>
> >>>P.
> >>
> >>
> >>
> >>_______________________________________________
> >>postgis-users mailing list
> >>postgis-users at postgis.refractions.net
> >>http://postgis.refractions.net/mailman/listinfo/postgis-users
> > 
> > 
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users at postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users

More information about the postgis-users mailing list