[mapserver-users] offset line more of a scribble then a line

Rahkonen Jukka Jukka.Rahkonen at mmmtike.fi
Sat Jul 21 05:28:48 PDT 2012


Hi,

I know why it happens but I do not know a general solution for making it look better. The coast line is splitted in short linestrings (max 2000 nodes it it is OpenStreetMap data) and offset is calculated individually for each line by using a perpendicular displacement for each vertex. If the cutting between linestrings happens to be in very concave or convex part of the coastline the result is like you see.  You will get the same result by using the ST_OffsetLine in PostGIS or Spatialite.

I would guess that there is something in the offset function for doing some arrangements if the concave/convex parts are in the middle of a linestring so that the resultining lines would not have self-intersections. Therefore you might get better looking result with less number of messy knots by combining some amount of linestrings with union function before the offset line is built. Also if coast line was cutted in very straight sections the mess would not look as bad.

I would guess that rather good result could be achieved on-the-fly by selecting first all the coastline segments inside the bounding box to be rendered, unioning them and building offset line for the union. I do not know how to do that with Mapserver but perhaps a clever view in PostGIS could do it automatically.

Matt McClelland wrote:


> Hi

> I am on mapserver 6.0, WMS

> This link has an example of the issue - a picture saves me a 1000 words :)
http://wildwalks.com/temp/offset issue.png<http://wildwalks.com/temp/offset%20issue.png>

> Basically I am trying to draw a line offset to the coast line.
> But the line that is appearing is more of a scribble then a neat line
> (the red line is the offset line, and the blue is the coast line.)

> Here is the relevant style bits form the mapfile
        STYLE ## COAST LINE
          COLOR 100 100 255
          WIDTH 1
        END
        STYLE  ## red offset line
          color 255 0 0
          WIDTH 5
          OFFSET 50 -99
        END

> Any clues on how to get the red line to run a little nicer  :)

> Thanks

> Matt  :)



More information about the mapserver-users mailing list