Opened 16 years ago

Closed 16 years ago

#2393 closed defect (fixed)

Pattern/STYLE is not used when drawing VECTOR symbols

Reported by: SB Owned by: tbonfort
Priority: normal Milestone: 5.2 release
Component: AGG Version: 5.0
Severity: normal Keywords: VECTOR STYLE
Cc:

Description

I need to draw a special pattern over a normal line (it's a railway containing white boxes over a black line). In my old 4.10.2 mapserver I used cartolines and that worked good for me, except for lacking antialiasing.

Now I upgraded to 5.0 and altered my mapfile according to the migration hints. As I can no more use cartolines, I tried to get the same result using a VECTOR symbol. But this symbol seems to ignore the style property, even if the documentation (http://mapserver.gis.umn.edu/docs/howto/cartosymbols/#construction-of-line-symbols) tells me the opposite.

I tried with a ELLIPSE-Symbol, which worked, but - as expected - gave an not so good optical result ("round" boxes). But that symbol uses the pattern in the STYLE-Attribute, as written in the documentation.

So it seems a bug for me, that the VECTOR-Symbol does not use the STYLE-Pattern. With a VECTOR forming a vertical line, the same bug occurs, the lines have always the same distance between them, regardless of the STYLE-setting.

This is a sample layer, using the symbol:

#sample layer, which shows a railway with white squares on a black line
LAYER
	NAME "Schienenverkehr"
	TYPE LINE
	STATUS ON
	CONNECTIONTYPE postgis
	CONNECTION "user=test password=test dbname=test_db host=localhost options='-c client_encoding=latin2'"
	DATA "the_geom from bahn"
	CLASS
		STYLE
			COLOR 0 0 0
			WIDTH 8
		END
		STYLE
			SYMBOL "bahn"
			COLOR 255 255 255
			SIZE 6
		END
	END
END

And that are two symbols, where the first symbol (ELLIPSE) uses the pattern and the second (VECTOR) does not.

#works, the pattern is used
SYMBOL
  NAME "bahn_2"
  TYPE ELLIPSE
  POINTS 1 1 END
  STYLE
    8 12 8 12
  END
  FILLED TRUE
END

#works not (the distance between the drawn vectors is always the same,
# regardless of the STYLE property - the pattern is not used
SYMBOL
	NAME "bahn"
    TYPE vector
    POINTS
		0 0
		0 1
		1 1
		1 0
		0 0
    END
    FILLED TRUE
    STYLE
        8 12 8 12
    END
END

My installation:

Mapserver 5.0 built from source on a suse-linux box (openSUSE 10.2)

mapserv -v: MapServer version 5.0.0 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE

Attachments (3)

Line_Vector.png (2.4 KB ) - added by SB 16 years ago.
That's how the line looks @ mapserver 5.0
Line_Ellipse.png (3.3 KB ) - added by SB 16 years ago.
That's how the line should look (except that it would have no round corners as the VECTOR)
railway.png (194 bytes ) - added by tbonfort 16 years ago.
pixmap symbol for railway lines

Download all attachments as: .zip

Change History (12)

comment:1 by tbonfort, 16 years ago

Component: MapServer C LibraryAGG
Owner: changed from sdlime to tbonfort

can you attach an image example of what you want and what you get please

by SB, 16 years ago

Attachment: Line_Vector.png added

That's how the line looks @ mapserver 5.0

by SB, 16 years ago

Attachment: Line_Ellipse.png added

That's how the line should look (except that it would have no round corners as the VECTOR)

comment:2 by SB, 16 years ago

Ok, I attached this two images:

The first is showing the line, as it is now - with a VECTOR-Symbol. The second is showing the line, when the symbol is changed to an ELLIPSE (all the attributes are the same).

The VECTOR should look similar to the ELLIPSE, except of the round edges of the white boxes, which wouldn't be round.

comment:3 by tbonfort, 16 years ago

btw: STYLE for a symbol is deprecated, and is replaced by PATTERN . I don;t think it was ever intended for spacing vector symbols on a line, but for drawing dashed lines.

to draw markers regularly spaced on a line, the keyword to use in your symbol is GAP if you specify a positive value, the symbols aren't rotated, if it's negative, they are rotated to follow the line orientation. there's a bug in the agg code right now if using a negative gap so you won't be able to try that. for railway symbols like what you want with agg, the best solution imho is to use a pixmap symbol, I'll attach an example to the bugreport.

then you'd use

SYMBOL
  NAME "rail"
  TYPE PIXMAP
  IMAGE "railway.png"
END

....

CLASS
  STYLE
    SYMBOL "rail"
  END
END

by tbonfort, 16 years ago

Attachment: railway.png added

pixmap symbol for railway lines

comment:4 by SB, 16 years ago

Thanks for the fast answer.

Drawing dashed lines was what I wanted to do ;-)

I tried GAP, but it had no effect on the VECTOR spacing. Isn't it used only for Truetype-Fonts?

Using a PIXMAP is not the best way I think, because I don't want extra files for just drawing a VECTOR. It would be good, if i could stick with a mapfile and a symbolfile. With mapserver 4.10.2 the obviously best way was using cartoline, which has gone for now in 5.0.

I thought it could be a bug, which results in different spacing between ELLIPSE and VECTOR, which shouldn't be so - according to the documentation. Or maybe the full cartoline functionality could be integrated in the normal styles.

comment:5 by tbonfort, 16 years ago

ok I see now. you'll have to wait for 5.2 when line caps (and pattern and gap to) will be brought into the STYLE block.

you'll then be able to get what you want with something like STYLE

WIDTH 6 CAPS SQUARE PATTERN 6 6

END

comment:6 by tbonfort, 16 years ago

sorry, with the formatting

STYLE
  WIDTH 6
  CAPS SQUARE
  PATTERN 6 6
END

comment:7 by SB, 16 years ago

Milestone: 5.2 release

Yes that's what I need, a simple line, which can have square ends and a pattern. So I have to wait, ok.

An extended STYLE-attribute directly in the mapfile would be the best solution, like your example shows.

I hope it's ok, to set the milestone therefore to 5.2.

comment:8 by tbonfort, 16 years ago

for the time being you can use:

SYMBOL
    NAME "bahn"
    TYPE vector
    POINTS
        0 0
        0.5 0
        0.5 0.3333
        0.25 0.3333
        0.25 0.6666
        0.75 0.6666
        0.75 0.3333
        0.5 0.3333
        0.5 0
        1 0
        1 1
        0 1
    END
    FILLED TRUE
END

and then

STYLE
 BACKGROUNDCOLOR 255 255 255
 COLOR 0 0 0
 SIZE 7
 SYMBOL 'bahn'
END

comment:9 by SB, 16 years ago

Resolution: fixed
Status: newclosed

That's a nice workaround. It looks exactly as expected (except of the round joins, that only cartoline provides).

And it works for me good with the AGG-renderer, GD produces just small points on the location of the line vertices.

So thank you again and I'll close this ticket, because it will be solved by the upcoming extended STYLE-functionality.

Note: See TracTickets for help on using tickets.