Page:
LineSymbolizer
Pages
A perfect testcase
API changes between v2.0 and v2.1
API changes between v3.0 and v3.1
AWS Lambda
About Mapnik
AlsoFilter
Api changes between v2.1 and v2.2
Api changes between v2.2 and v2.3
Api changes between v2.3 and v3.0
ArchInstallation
Aspect Fix Mode
Benchmark Notes
BoundsClipping
BrokenExceptions
BuildingSymbolizer
CSV Plugin
CairoVersions
CentOS_RHEL
ChangeLog
Code sprint
CodingStandards
Compiler Notes
Compositing
Contributing
DebianInstallation
DebugSymbolizer
DebuggingMapnik
DemoGallery
DeveloperTopics
DevelopingPlugins
Development
ElseFilter
ExampleCode
Expression
FasterCompiling
Fasterlabeling
Filter
FontSet
FreeBSDInstallation
GDAL
GEOS
GSOC Ideas
GSOC2010
GSOC2010_Application
GSOC2010_Ideas
GSOC2011
GSOC2011_Ideas
GeoJSON Plugin
GettingStarted
GettingStartedInPython
GettingStartedInXML
GlyphSymbolizer
GroupSymbolizer
Grouped rendering
Gsoc2012 application
Gsoc2012
HaitiStyles
Home
Ideas
Ideas_Compositing
Ideas_FutureMapnik
Image IO
InstallationTroubleshooting
InternationalText
IntroductionToGIS
Kismet
LabelingSupport
Layer
LearningMapnik
Legending
LinePatternSymbolizer
LineSymbolizer
LinuxInstallation
Logging
MacInstallation
MacInstallationSource
MacInstallation_Homebrew
MacPostGIS_Setup
MacPythonUpgradeIssues
ManagingLargeXmlFiles
MapDesign
Mapnik Development
Mapnik Installation
Mapnik with wxPython
Mapnik2
Mapnik2_Changes
MapnikCodeSprint
MapnikCodeSprint_MCS01
MapnikCodeSprint_MCS01_Location
MapnikCodeSprint_MCS01_Results
MapnikCodeSprint_MCS01_Schedule
MapnikCodeSprint_MCS02
MapnikCoreConcepts
MapnikDependencies
MapnikInstallationSvn
MapnikReferences
MapnikReleaseSteps
MapnikReleases
MapnikRenderers
MapnikTutorials
MapnikUtilities
MapnikViewer
Mapnikinstallation
MarkersSymbolizer
MaxScaleDenominator
MemoryDatasource
MetaWriter
MinScaleDenominator
ModServer
Nik2Img
Notes and caveats
OCCI
OGR
OpenSolarisInstallation
OpenSolarisInstallation_32bit
OpenSolarisInstallation_64bit
OpenSolarisInstallation_TroubleShooting
OpenSuse
OpenSuseInstallation
OptimizeRenderingWithPostGIS
OsmPlugin
OutputFormats
PackageBuilding
Paleoserver
Path Expression
PgRaster
PluginArchitecture
PointSymbolizer
PolygonPatternSymbolizer
PolygonSymbolizer
PostGIS
Postgis async
Python Plugin
Python3k
RFC: Raster color interpretation
Raster
RasterColorizer
RasterSymbolizer
Rasterlite
Related projects and utilities
Release0.6.0
Release0.6.1
Release0.7.0
Release0.7.1
Release0.7.2
Release2.0.0
Release2.0.1
Release2.0.2
Release2.1.0
Release2.2.0
Runtime Logging
SQLite
SVG support
Scale factor
ScaleAndPpi
ShapeFile
ShieldSymbolizer
ShieldSymbolizerTests
Style
StyleShare
Svg rendering gochas
SymbologySupport
Text Rendering Overview
TextSymbolizer
Trac to Github wiki migration notes
Troubleshooting
UbuntuInstallation
UbuntuInstallationOld
UsingCustomFonts
UsingScons
WindowsInstallation
World population tutorial
XMLConfigReference
XmlFormatDiscussion
iOS
mapnik.Datasource
mapnik.Layer
mapnik.Map
my choice
No results
15
LineSymbolizer
Jez Nicholson edited this page 2018-01-23 12:53:12 +00:00
Symbolizer that specifies rendering of a "stroke" along a linear geometry.
Configuration Options
parameter | value | description | unit | default | accepts expressions |
---|---|---|---|---|---|
stroke | CSS colour | A Color value such as 'green' or #A3D979 | - | "black" | mapnik >= 3.0 |
stroke-width | 0.0 - n | Width of line | pixels | 1.0 | mapnik >= 3.0 |
stroke-opacity | 0.0 - 1.0 | 1 is fully opaque while zero is fully transparent and .5 would be 50% transparent | transparency | 1.0 | mapnik >= 3.0 |
stroke-linejoin | miter, round, bevel | See SVG stroke-linejoin for an example for each value | - | miter | no |
stroke-linecap | round, butt, square | See SVG stroke-linecap for an example for each value | - | butt | no |
stroke-dasharray | 0.0 - n,0.0 - n | A pair of length values [a,b], where (a) is the dash length and (b) is the gap length respectively. More than two values are supported as well (e.g. to start the line not with a stroke, but with a gap). | pixels | none | no |
comp-op | Compositing | none | no | ||
smooth | 0.0 - 1.0 | 1 means completely smoothed lines, 0 means no change | - | 0.0 |
Examples
Default
<LineSymbolizer />
XML
<LineSymbolizer stroke="#0000ff" stroke-width="4" />
Python
l = LineSymbolizer(Color('green'),0.1)
To work directly with the stroke object:
l = LineSymbolizer()
s = Stroke(Color('green'),0.1)
s.add_dash(.1,.1)
s.opacity = .5
l.stroke = s
Fetch all the possible methods like:
>>> from mapnik import LineSymbolizer
>>> dir(LineSymbolizer().stroke)
C++
rule_type rule;
stroke ls; // This is the line symbolizer
ls.set_color(color(255, 255, 255));
ls.set_width(4); // width of the line in pixels
ls.set_line_join(mapnik::ROUND_JOIN);
ls.set_line_cap(mapnik::ROUND_CAP);
ls.add_dash(2.5, 1.0);
ls.set_opacity(0.5);
rule.append(ls);