API changes between v2.0 and v2.1
Clone this wiki locally
- Python pickling support was removed for
map/style/rule/symbolizers/fontset/query- these were poorly maintained and future support for fast, core deepcopy should handle most key use cases - see #1390 (map deepcopy)
MetaWriter- disabled in 2.1.x series - may be re-enabled in future releases
MemoryDatasourceinstead. PointDatasource was an incomplete wrapper around MemoryDatasource, and is obsolete now that
Featureobjects can leverage WKB and WKT to create geometries and features can be added to MemoryDatasources.
GlyphSymbolizer- functionality can now be achieved with the
marker-typeis removed, built in ellipse and arrow types now can be referenced like
file="shape://arrow"- although this interface is unstable and may continue to change.
no_text- Simply leave the text empty if you don't want any text to be rendered.
utils/xmlsince it was unmaintained: https://github.com/mapnik/mapnik/issues/1402
line- meaning if you want your symbols (like arrows) to be oriented along lines you now need to specify
placement=line, whereas previously this was the default. This changes reflects the goal of making the MarkersSymbolizer default behavior more reasonable for any geometry type, including points, lines, and polygons and to make it consistent with the
ShieldSymbolizerwhich also default to
heightare now optional expressions rather than raw floats and their values represent diameter in pixels not radii. If not set they will be
None, but the default ellipse has a
10meaning that if you set
height="20"then there will be no change in the rendering size of the ellipse. The arrow default dimensions can be roughly maintained with
width="15" height="10". But to get the exact rendering of the Mapnik 2.0.x arrow use this svg file. Altering width or height will build a new
ellipsesvg marker internally by default if no custom file type is provided. For non-ellipse types setting
heightwill proportionally scale the marker, but ideally you should use `transform="scale(x,y)" instead.
- A new
fill-opacitysetting is available and now
opacityreverse to a new overall opacity that will be multiplied against the
stroke-opacity- this is to match how svg behaves.
- In Python a mapnik.Feature now expects a mapnik.Context() as a first argument and a feature id as the second argument, which stores all attribute names (previously mapnik.Feature only needed a single argument of the feature id and redundantly stored feature attribute names per feature) #834.
opacityvalue now works to set the alpha of bitmap images.
Expression- you can now use the built in keyword of
[mapnik::geometry_type]to filter features by geometry type either by name or integer key. The mapping is
4:collection. A collection indicates that the
Featurehas more than one geometry of different types. So a
Featurewith three linestrings will be reported as
Featurewith a point and a linestring will be reported as a
collection. - for more details see #546
- To All symbolizers (in most cases)
comp-op- All symbolizers now support compositing in the AGG and Cairo renderers
clip- All(most) symbolizers - boolean of whether to clip geometries before rendering (defaults to
smooth- bezier smooth value - 0-1, 0 (default) means no smoothing, 1 means fully smoothed, higher values create wild loopbacks
offset- offset lines either in positive (right side) or negative (left side)
- New placement alogrithm:
- Text formatting
Changes documented in TextSymbolizer documentation
- New placement alogrithm:
- Python Bindings:
mapnik.Image.get_pixel()- get unsigned int value representing the rgba value, useful for fast pixel comparisons
mapnik.Grid.get_pixel()- get int value representing the feature id encoded in the grid pixels
- bindings for text placement and formatting work
TextSymbolizer- most attributes moved to either
Backward compatibility is preserved by python wrappers, however a warning message is printed if the old name is used.
modeis deprecated, now use
comp-opwhich supports many more compositing modes
- The new mapping from
divide-> Not supported anymore, see: https://github.com/mapnik/mapnik/issues/1432
scaling=fastis deprecated. It has always been a synonym for
scalingis now exposed in python as enumerations of
mapnik.scaling_methodnot as bare strings