Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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
1  
A similar question was asked after this one, and it did get a response, albeit inconclusive: (gis.stackexchange.com/questions/56835/…) How to perform SIA or Bezier line smoothing in PostGIS? –  martin f Oct 29 '13 at 23:12
add comment

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.