15 PointSymbolizer
Jez Nicholson edited this page 2018-01-23 13:32:21 +00:00

Symbolizer that specifies rendering of a png, tiff, or svg graphic symbol at a point.

To combine a graphic symbol with a text label, use a ShieldSymbolizer. If you want to change the image offset, use a MarkersSymbolizer.

/images/point_symbolizer_1.png /images/streets2.png

Configuration Options

Some options described here are not available in mapnik versions < 2.0.

parameter value default accepts expressions
file path to image file none mapnik >= 2.0
width (removed) px 4
height (removed) px 4
type (removed) png tiff svg none
allow-overlap allow text to overlap the point image; true/false false no
opacity Opacity of the symbolizer: 0.0 - 1.0 1.0 no
transform SVG transform identity mapnik >= 3.0
you have to specify transform, but you can use expressions for its parameters, e.g. "rotate([value1]) scale([value2])"
ignore-placement allow subsequent point/shield symbolizers to overlap this symbol; true/false false no
comp-op Compositing none no

Examples

Default

XML

    <PointSymbolizer/> 

Python

    sym = PointSymbolizer()

C++

    using mapnik::point_symbolizer;
    point_symbolizer sym;

Image label

/images/point_symbolizer_2.png

XML

    <PointSymbolizer file="/tmp/pub.png" transform="scale(2)" /> 

Python

    sym = PointSymbolizer("/tmp/pub.png", "png", 16, 16)
    # args are file, type, height, width
    sym.allow_overlap = True
    sym.opacity = .5

C++

    using mapnik::point_symbolizer;
    point_symbolizer sym("/tmp/pub.png","png",16,16);

Allow Overlap

XML

    <PointSymbolizer allow-overlap="yes" file="/Users/artem/projects/ 
    openstreetmap/mapnik/symbols/station_small.png" />

Do Not Allow Overlap

XML

    <PointSymbolizer allow-overlap="no" file="/Users/artem/projects/ 
    openstreetmap/mapnik/symbols/station_small.png" />

SVG symbols (trunk)

/images/point_symbolizer_svg.png

    <PointSymbolizer file="/Users/artem/Desktop/svg/lion.svg" opacity="1.0" transform="scale(0.2,0.2)" />

/images/point_symbolizer_svg2.png

    <PointSymbolizer file="/Users/artem/Desktop/svg/lion.svg" opacity="1.0" transform="rotate(45) scale(0.4,0.4)" />