Offset a line?

thomas bonfort thomas.bonfort at GMAIL.COM
Thu Aug 30 03:46:13 EDT 2007


offsetting a line by a fixed offset will rarely give a satisfying result unless
the line is more or less of a constant direction.
as you're using AGG you're in luck as there are at least two ways of getting
what you want. You can try this with a beta version , but the version
in svn as of now,
or the RC version in a weeks time will contain/ contains a few bug
fixes that correct a couple of artifacts that you will get with beta6

the first way is using a vector symbol:
SYMBOL
    NAME 'solidanddash'
    TYPE VECTOR
    POINTS
    0 0
    1 0
    -1 -1
    .25 0.5
    .75 0.5
    END
    LINECAP SQUARE
    FILLED FALSE
END

and then
STYLE
  COLOR 0 0 0
  SYMBOL 'solidanddash'
  SIZE 5
  WIDTH 1 #use WIDTH 2 if using beta6 or lower to circumvent a
rendering artifact
END


the second way is using a pixmap symbol as a brush for the line as
attached to this email.
again, using beta6 or lower you'll get a faint outline around the
pixmap. this is corrected in svn / rc1.

SYMBOL
  NAME "semidashed"
  TYPE PIXMAP
  IMAGE "semidashed.gif"
END

and then in your mapfile

STYLE
  SYMBOL 'semidashed'
  # no use setting width or size here, if you need a wider line, use a
bigger semidashed.gif
END



HTH,
thomas

On 8/29/07, Pete Deffendol <pete at mdsc.com> wrote:
> Pete Deffendol wrote:
> > I'm trying to draw a line layer such that it is offset some amount of
> > pixels from its actual location.  The intent is to draw a dashed line
> > next to (not atop) a road.  From the documentation, it appears that
> > using OFFSET in the STYLE block will work, but it's not having any
> > affect on the output.  Here's the relevant section of my mapfile:
>
> Let me be more specific.  I'm using AGG rendering as well.  If I turn it
> off, then the offset appears to work, although it's really ugly and
> doesn't look the way I want.  (The offset line doesn't just look like a
> mirror of the original line that has been shifted over - it has a few
> "anomalies" that shift a different direction.)
>
> So - any other ideas on how I can achieve what I want? (see above quoted
> message.)
>
> Pete
>
> --
> Pete Deffendol
> Software Engineer
> Multimedia Data Services Corp.
> pete at mdsc.com
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: semidashed.gif
Type: image/gif
Size: 40 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/mapserver-users/attachments/20070830/65aee046/semidashed.gif


More information about the mapserver-users mailing list