Post on 25-Dec-2014
description
transcript
17 / 10 / 2012 Rencontres OSGEO
Thomas Bonfort (Terriscope)
Advanced Cartography with MapServer 6.2
6.2 Rendering Highlights
• SVG Symbols • Vector Fields • Complex Symbols • Offset Labels • Layer Masking • Multiple Fonts for International Text
SVG Symbols
• Existing symbology limited for some use cases • Scalable, multiple colors
SYMBOL NAME "svgsymbol" TYPE SVG IMAGE "/path/to/symbol.svg" END
STYLE SYMBOL "svgsymbol" SIZE 10 ANGLE 45 END
MultiLanguage Font Support
• LABEL->FONT now takes comma separated list of fonts to try
• Each font will be tried in turn if glyph not found
Mask Layers
• Clip rendered data across given features
layer name "countries” status off class expression (“[FIPS]” = “EZ”) style color 0 0 0
layer status on name ”naturalearth” mask “countries” type raster
Precise symbol placement
• Default is to center symbol on feature point • Typically useful for arrow type symbols • SYMBOL
– ANCHORPOINT x y • STYLE
– POLAROFFSET [distance] [bearing]
Complex symbols
Complex symbols
• Collision avoidance: implemented along with the labelcache.
• “All or nothing” approach: in case of collision, whole symbol is discarded.
• Each sub-symbol is positioned relatively to the anchor point, and defined as a LABEL block.
• Collision detection between sub-symbols is optional.
• Addresses meteo symbol generation, other use cases in future versions
Complex symbols LAYER CLASS LABEL OFFSET -15 -10 FORCE GROUP TEXT “[temp]” END LABEL EXPRESSION ([wind_speed]<=5) STYLE GEOMTRANSFORM “labelpnt” SYMBOL “v5” SIZE 30 ANGLE [wind_angle] FORCE GROUP END END LABEL EXPRESSION ([wind_speed]<=10) STYLE SYMBOL “v10” … END END ….
Vector Fields
Vector Fields
• u,v components stored in raster bands • Mapped to vector points in resulting map • Additional bindings used for styling:
– [uv_angle] – [uv_length]
• Decoupling size of arrow body and head
LAYER TYPE POINT CONNECTIONTYPE uvraster DATA “wind.tif” CLASS STYLE SYMBOL "arrowbody" ANGLE [uv_angle] SIZE [uv_length] COLOR 0 127 20 END STYLE SYMBOL "arrowhead" ANGLE [uv_angle] SIZE 10 COLOR 255 0 0 POLAROFFSET [uv_length_2] [uv_angle] END END END
SYMBOL NAME "arrowbody" TYPE VECTOR POINTS 0 0 1 0 END # points END SYMBOL NAME "arrowhead" TYPE vector FILLED true ANCHORPOINT 1 0.5 POINTS 0 2 4 1 0 0 END END
Vector Fields
Label Leader Offsetting
• Displace label if collision occurs on initial position
• NP-hard problem! – Test offsetted positions on a regular grid – O(nlabels * image_size)
• Leader line can be styled • Offsets whole label group, future work on
offsetting each sub-label
Label Leader Offsetting
LAYER CLASS LEADER MAXDISTANCE 100 GRIDSTEP 10 STYLE COLOR 0 0 0 WIDTH 1 #PATTERN 2 2 END END END LABEL … END END END
Putting it all together
6.2 Other Notable Highlights
• First release with tinyOWS and Mapcache • INSPIRE view services • WMS DIM_* dimensions • Source code repository migration • GD library now optional • Speedups and Memory usage reduction • Build changed: libtool + shared library
Future
• Text placement: – Alignment – Spacing – Line following
• Further work on multiple and/or offsetted labels
• Carto/css? • Mod_mapserver
Want More?
• Docs: http://www.mapserver.org/index.html • Code: https://github.com/mapserver/mapserver
• Release date: soon !