Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to automatically generate paths to place labels on that follow the shape of rivers, 4wd tracks and other very windy lines. At first I thought the st_simplify() function was the answer, but it basically has exactly the opposite goal. Here's a result of st_simplify(way,300):

enter image description here

st_simplify() is trying to preserve the maximum amount of information from the underlying geometry, resulting in a very spiky line. What I'm looking for is a rough approximation of the line - something that would kind of pass down the center, without actually hitting any of the corner points.

The ultimate goal is to get more labels rendered in TileMill, without having to increase the text-max-char-angle-delta setting, which looks pretty bad.

Is there a way to achieve this? I'm looking for a script or function to call - not just an algorithm to attempt to implement.

(OpenStreetMap data in PostGIS, rendered using TileMill. Happy to pre-process - performance is not a big concern.)

Also, note the difference from this question - I don't want "a smoother line of roughly the same significance to a human interpreter", I want "a smoother line roughly in the centre of the old line".

share|improve this question
A similar question was asked after this one, and it did get a response, albeit inconclusive: (…) How to perform SIA or Bezier line smoothing in PostGIS? – Martin F Oct 29 '13 at 23:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.