Clean up.
parent
4c831ffe56
commit
c1d2f59238
1 changed files with 20 additions and 67 deletions
|
@ -1,51 +1,27 @@
|
|||
<!-- Name: ShieldSymbolizer -->
|
||||
<!-- Version: 34 -->
|
||||
<!-- Last-Modified: 2011/11/13 15:42:36 -->
|
||||
<!-- Author: migurski -->
|
||||
# New documentation
|
||||
## Configuration Options for ShieldSymbolizer
|
||||
|
||||
NEW: Starting from r1793 ShieldSymbolizer supports [Scalable Vector Graphics (SVG)](http://www.w3.org/TR/SVG/) as input images,
|
||||
see examples below.
|
||||
|
||||
ShieldSymbolizer supports all options of [[TextSymbolizer]] and the following additional options:
|
||||
|
||||
| *parameter* | *value* | *default* |
|
||||
|------------------|---------|-----------|
|
||||
|allow-overlap | Allow the symbolizer to overlap others | false|
|
||||
|avoid-edges | Attempts to stay away from the edge of the image | false|
|
||||
|base | Base symbol template. See [#574](http://trac.mapnik.org/changeset/574) (XML config only) | |
|
||||
|character-spacing | Horizontal spacing between characters (in pixels). Currently works for point placement only, not line placement | 0|
|
||||
|dx | Offset the text horizontally. Unit: pixels from the image's center | 0|
|
||||
|dy | Offset the text vertically. Unit: pixels from the image's center. Also see note at vertical_alignment. | 0|
|
||||
|face-name | Font name for the shield text | |
|
||||
|base | Base symbol template (See below)| |
|
||||
|file | The file to use for the shield background | |
|
||||
|fill | Color of the shield text, e.g. #FFFFFF | |
|
||||
|fontset-name | Name of the FontSet to use. (XML config only) | |
|
||||
|halo-fill | Color of the colored halo around the text, e.g. #AF2304. | white |
|
||||
|halo-radius | Thickness of the colored halo around the text as an integer value in pixels | 0 |
|
||||
|height | The height of the shield file | image's height |
|
||||
|horizontal-alignment | | "middle" |
|
||||
|justify-alignment | | "middle"|
|
||||
|line-spacing | Vertical spacing between lines of multi-line labels, in pixels | 0|
|
||||
|minimum-distance | Minimum distance to the next shield symbol, not necessarily the same shield | 0|
|
||||
|name | This is the query field you want to use for the label text, e.g. "ref" | |
|
||||
|no-text | | false|
|
||||
|opacity| opacity of the image used for the shield | 1|
|
||||
|text-opacity | opacity of the text placed on top of the shield | 1|
|
||||
|placement | "line" or "point" | |
|
||||
|placement-type| ?||
|
||||
|size | Font size of the shield text (a value of zero will prevent text from being written) | |
|
||||
|spacing | The spacing between repeated occurrences of the same shield | |
|
||||
|text-transform | Allows conversion of text to lower or upper case before display. Values are "none", "uppercase", "lowercase" and "capitalize". | "none"|
|
||||
|type | Type of the shield file, e.g. "png" | |
|
||||
|unlock-imageplacements | If "false", the symbol is placed relative to the text box center. If "true", the symbol is placed relative to the point position | "false"|
|
||||
|vertical-alignment | Position of label relative to point position ("top" to label on top of a point, "middle", "bottom") for dy = 0, "bottom" for dy > 0, "top" for dy < 0 | "middle"|
|
||||
|width | The width of the shield file| image's width |
|
||||
|wrap-before| | "false"|
|
||||
|wrap-character | Use this character instead of a space to wrap long names | " "|
|
||||
|wrap-width | Length before wrapping long names| 0 |
|
||||
| transform | *Development version (trunk)* [SVG transform] (http://www.w3.org/TR/SVG/coords.html#TransformAttribute) | |
|
||||
|shield-dx|offset the shield image horizontally | |
|
||||
|shield-dy|offset the shield image vertically | |
|
||||
|unlock-image | No known function | "false" |
|
||||
|shield-dx|offset the shield image _and text_ horizontally | 0 |
|
||||
|shield-dy|offset the shield image _and text_ vertically | 0 |
|
||||
|transform|[[Transform]] image| |
|
||||
|
||||
### placement
|
||||
`placement="line"` actually means points along a line for ShieldSymbolizer.
|
||||
|
||||
### base
|
||||
Add
|
||||
`<FileSource name="foo">/home/bar/baz/</FileSource>`
|
||||
to the beginning of your stylesheet and then use
|
||||
`<ShieldSymboliser base="foo" name="bridge">`
|
||||
to refer to /home/bar/baz/bridge.
|
||||
|
||||
## Good to know
|
||||
|
||||
|
@ -64,16 +40,11 @@ To draw labeled points configure your shield symbolizer with placement = point a
|
|||
Setting up a sample shield symbolizer, from the Cascade Users of OpenSource GeoSpatial (CUGOS) list:
|
||||
http://groups.google.com/group/cugos/browse_thread/thread/b62b4890e1933bba
|
||||
|
||||
### Default
|
||||
|
||||
|
||||
#### XML
|
||||
|
||||
|
||||
```xml
|
||||
<Style name="My Style">
|
||||
<Rule>
|
||||
<ShieldSymbolizer name="NAME" face-name="DejaVu Sans Bold" size="6" fill="#000000" file="images/ushighway_shield_20.png" type="png" width="20" height="20" spacing="100" min-distance="50"></ShieldSymbolizer>
|
||||
<ShieldSymbolizer face-name="DejaVu Sans Bold" size="6" fill="#000000" file="images/shield.svg" width="20" height="20" spacing="100" transform="scale(2.0,2.0)" min-distance="50">[NAME]</ShieldSymbolizer>
|
||||
</Rule>
|
||||
</Style>
|
||||
```
|
||||
|
@ -81,13 +52,6 @@ http://groups.google.com/group/cugos/browse_thread/thread/b62b4890e1933bba
|
|||
#### Python
|
||||
|
||||
```python
|
||||
shield = ShieldSymbolizer('NAME','DejaVu Sans Bold',6,Color('#000000'),'images/ushighway_shield_20.png','png',20,20)
|
||||
# parameters are: (name, font name, font size, font color, image file, image type, width, height)
|
||||
shield.min_distance = 50
|
||||
shield.label_spacing = 100
|
||||
shield.displacement(dx,dy)
|
||||
|
||||
#Mapnik Version 2:
|
||||
shield = ShieldSymbolizer(Expression('[NAME]'),'DejaVu Sans Bold',6,Color('#000000'),PathExpression('images/ushighway_shield_20.png'))
|
||||
shield.min_distance = 50
|
||||
shield.label_spacing = 100
|
||||
|
@ -108,26 +72,15 @@ http://groups.google.com/group/cugos/browse_thread/thread/b62b4890e1933bba
|
|||
width
|
||||
height
|
||||
*/
|
||||
shield_symbolizer ss("NAME", "DejaVu Sans Bold", 6, color(0, 0, 0), "/path/to/icon.png", "png", 20, 20);
|
||||
shield_symbolizer ss("[NAME]", "DejaVu Sans Bold", 6, color(0, 0, 0), "/path/to/icon.png", "png", 20, 20);
|
||||
ss.set_label_placement(mapnik::LINE_PLACEMENT); // Place label along the line
|
||||
ss.set_displacement(dx, dy);
|
||||
ss.set_label_spacing(min_distance);
|
||||
rule.append(ss);
|
||||
```
|
||||
|
||||
## SVG shields
|
||||
|
||||
[[/images/shield_symbolizer_svg.png]]
|
||||
|
||||
```xml
|
||||
<Style name="My Style">
|
||||
<Rule>
|
||||
<ShieldSymbolizer name="'ABC'" fontset-name="bold-fonts" size="10" fill="green" placement="line" file="/Users/artem/Desktop/svg/shield.svg" transform="scale(2.0,2.0)" min-distance="100" spacing="250"/>
|
||||
</Rule>
|
||||
</Style>
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
http://www.routemarkers.com/
|
||||
http://www.weait.com/content/badges-badges
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue