u PointSymbolizer :点符号
parameter |
value |
default |
file |
图片文件名路径 |
none |
width |
图片显示像素宽度 px |
4 |
height |
图片显示像素高度 px |
4 |
type |
图片类型 (png 或 tiff) |
none |
allow_overlap |
是否容许压盖 true/false |
false |
opacity |
符号透明度( 0.0 - 1.0 ) |
1.0 |
样例 |
<PointSymbolizer file="/tmp/pub.png" width="16" height="16" type="png" /> |
u LineSymbolizer :线符号
parameter |
value |
description |
unit |
default |
stroke |
CSS colour |
颜色值 A Color value such as 'green' or #A3D979 |
- |
"black" |
stroke-width |
0.0 - n |
线宽 Width of line |
pixels |
1.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 |
stroke-linejoin |
miter, round, bevel |
线接头类型 See http://www.w3.org/TR/SVG/painting.html#propdef-stroke-linejoin for an example for each value |
- |
miter |
stroke-linecap |
round, butt, square |
线头类型 See http://www.w3.org/TR/SVG/painting.html#propdef-stroke-linecap for an example for each value |
- |
butt |
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 |
样例 |
<LineSymbolizer stroke="rgb(171,158,137)" stroke-width="4" stroke-linejoin="round" stroke-linecap="round"/> |
u LinePatternSymbolizer :线图案符号
parameter |
value |
default |
file |
文件路径 path to image file |
none |
base |
base path where to search for file |
none |
width |
图片显示像素宽度 px |
4 |
height |
图片显示像素高度 px |
4 |
type |
图片类型 (png 或 tiff) |
none |
样例 |
<LinePatternSymbolizer width="16" height="16" type="png" file="/path/to/icon.png"/> |
u PolygonSymbolizer :面填充符号
parameter |
value |
default |
fill |
颜色值 CSS colour |
"grey" |
fill-opacity |
透明度 0.0 - 1.0 |
1.0 |
gamma |
伽马值 0.0 – 1.0 |
1.0 |
样例 |
<PolygonSymbolizer fill="rgb(100,255,100)"/ fill-opacity="0.5"> |
u PolygonPatternSymbolizer :面图案填充符号
parameter |
value |
default |
file |
文件路径 path to image file |
none |
width |
图片显示像素宽度 px |
4 |
height |
图片显示像素高度 px |
4 |
type |
图片类型 (png 或 tiff) |
none |
样例 |
<PolygonPatternSymbolizer width="16" height="16" type="png" file="/path/to/icon.png"/> |
u MarkersSymbolizer :主要用于标记道路的方向
样例: <MarkersSymbolizer />
u GlyphSymbolizer :字模符号,用于点显示一个字符
parameter |
description |
face_name |
字体名字 |
allow_overlap |
是否容许压盖 |
avoid_edges |
是否避免边界 |
halo_fill |
字体边线颜色 |
halo_radius |
字体边线半径 |
value |
? |
angle |
旋转角度 |
angle_mode |
角度模式,方位角( AZIMUTH ),三角( trigonometric ) |
char |
显示的字符 |
size |
字体大小 |
RasterColorizer |
栅格颜色表 |
样例 |
<Style name="arrows"> <Rule> <Filter>([FEATCODE] ='2010302')</Filter> <GlyphSymbolizer face_name="Microsoft YaHei Regular" allow_overlap="0" avoid_edges="0" halo_fill="rgba(0%,0%,0%,9%)" halo_radius="1" value="[value]" angle="90" angle_mode="trigonometric" char="' 文 '" size="12" > <RasterColorizer> <ColorBand value="0" color="#0044cc"/> <ColorBand value="10" color="#00cc00"/> <ColorBand value="20" color="#ffff00"/> </RasterColorizer> </GlyphSymbolizer> </Rule> </Style> |
u RasterSymbolizer :用于栅格数据的一些设置,基本不用
parameter |
value |
description |
opacity |
0.0 - 1.0 |
1 is fully opaque while zero is fully transparent and .5 would be 50% transparent |
mode |
grain_merge, grain_merge2, multiply, multiply2, divide, divide2, screen, hard_light |
Compositing/Merging effects with image below raster level (?). The formulas for combinding foreground (raster) and background are: grain_merge: bg + fg - 0.5, grain_merge2: bg + 2*fg - 1.0, multiply: fg * bg, multiply2: 2 * fg * bg, divide: bg / fg, divide2: 2*bg / fg, screen: (1-fg)*(1-bg), hardlight: see [http://docs.gimp.org/en/gimp-concepts-layer-modes.html#id2834930] |
scaling |
fast, bilinear, bilinear8 |
fast: nearest neighbour, bilinear: bilinear interpolation for all 4 channels (RGBA), bilinear8 like bilinear, but only one channel assumed |
样例 |
<Style name="raster"> <Rule> <RasterSymbolizer> <CssParameter name="opacity">0.5</CssParameter> <!--<CssParameter name="scaling">fast</CssParameter>--> <CssParameter name="scaling">bilinear</CssParameter> <!--<CssParameter name="scaling">bilinear8</CssParameter>-->
<!--<CssParameter name="mode">grain_merge</CssParameter>--> <!--<CssParameter name="mode">grain_merge2</CssParameter>--> <!--<CssParameter name="mode">multiply</CssParameter>--> <CssParameter name="mode">multiply2</CssParameter> <!--<CssParameter name="mode">divide</CssParameter>--> <!--<CssParameter name="mode">divide2</CssParameter>--> <!--<CssParameter name="mode">screen</CssParameter>--> <!--<CssParameter name="mode">hard_light</CssParameter>--> </RasterSymbolizer> </Rule> </Style>
|
u BuildingSymbolizer :常用于模拟建筑的 3D 效果
parameter |
value |
default |
fill |
CSS colour 颜色 |
"FIXME" |
fill-opacity |
integer 透明度 |
"FIXME" |
height |
integer 阴影高度 |
“FIXME” |
样例 |
<Style name="test"> <Rule> <BuildingSymbolizer> <CssParameter name="fill">yellow</CssParameter> <CssParameter name="fill-opacity">.7</CssParameter> <CssParameter name="height">30</CssParameter> </BuildingSymbolizer> </Rule> </Style> |
u TextSymbolizer :文本标注符号
name |
This is the query field you want to use for the label text, e.g. "street_name" 文本标注使用的属性字段 |
face_name |
Font name (see UsingCustomFonts) ,标注的字体名 |
fontset_name |
? 使用的字体集 |
size |
Font size 字体大小 |
text_ratio |
? 文本旋转角度(点标注有效) |
wrap_character |
Use this character instead of a space to wrap long names (since r1254) 换行字符(点标注有效) |
wrap_width |
Length before wrapping long names 换行宽度(点标注有效) |
text_convert |
Allows conversion of text to lower or upper case before display. Values are "none" (default), "toupper", and "tolower". (since r1254) 字符转换,用于英文字符 |
line_spacing |
Vertical spacing between lines of multiline labels (in pixels) (since r1254) 行间距(点标注有效,在多行文本下) |
character_spacing |
Horizontal spacing between characters (in pixels). Currently works for point placement only, not line placement. (since r1254) 字符间距 |
spacing |
Space between repeated labels 周期标注的间隔宽度(线标注有效),当值大于线长度时,不再显示(可选,默认是在线的中心位置绘制一次) |
label_position_tolerance |
Allow labels to be moved from their point in line placement. Integer value representing distance along a line in line placement mode, defaults to 1/2 min_distance. |
Force_odd_labels |
Force an odd amount of labels to be generated. Defaults to false. 强制只显示奇数标注 |
max_char_angle_delta |
Maximum angle (in degrees) between two consecutive characters in a label allowed (to stop placing labels around sharp corners) see r365 for more info 两个字符间最大相差角度(用于控制拐角 线拐角标注是否显示) |
fill |
Color of the text fill, e.g. #FFFFFF 字体颜色 |
halo_fill |
Color of the text halo 字体边线颜色 |
halo_radius |
Radius of the halo in whole pixels (fractional pixels are not accepted) 边线宽度 |
dx, dy |
Displace label by fixed amount on either axis. Also see note at vertical_alignment X 、 Y 方向的平移大小 |
avoid_edges |
Boolean to avoid labeling near intersection edges 是否避免边界相交的标注(避免边界裁剪) |
min_distance |
Minimum distance between repeated labels such as street names or shield symbols (works across features, added in r490) 标注的容限距离(判断是在标注的基础上扩大这个距离后在做的判段) |
allow_overlap |
Allow labels to overlap other labels – Note: you can also clear the label collision cache at the LAYER level to promote more overlap. See ‘clear_label_cache’ at wiki:XMLConfigReference#Layer 是否容许压盖 |
placement |
“line” to label along lines instead of by point 标注类型(点标注或者线标注) |
vertical_alignment |
Position of label relative to point position (“top” (label on top of point), “middle”, “bottom”) default is “middle” for dy=0, “bottom” for dy>0, “top” for dy<0 (since r1527, “middle” before that) 纵向放置方式, top 放置在点的上方、 middle 居中、 Bottom 放在下方 |
horizontal_alignment |
(Default “middle”) 水平放置对其方式 |
justify_alignment |
(Default “middle”) 多行文本时的文本对齐方式 |
wrap_before |
(Default “false”) ,换行优先级设置, true 为换行符优先 |
样例 |
<Style name="highway-label"> <Rule> <Filter>([FC]<=4)</Filter> <TextSymbolizer name="[BYNAMEC]" face_name="Microsoft YaHei Regular" size="12" fill="rgb(0,0,255)" placement="line" halo_radius="1" halo_fill="rgb(255,255,200)" line_spacing="100" avoid_edges="1" allow_overlap="1" min_distance="50" max_char_angle_delta="60" /> </Rule> </Style> |
u ShieldSymbolizer :图片与文本组号符号
继承于 TextSymbolizer ,具有 TextSymbolizer 的所有属性,并添加以下属性,常用于国道、省道的道路标注及同时带有图片及文本的点符号标注
height |
The height of the shield file (Defaults to image’s height) 图片显示高度 |
width |
The width of the shield file. (Defaults to image’s width) 图片显示宽度 |
file |
The file to use for the shield background ,图片文件路径 |
opacity |
(Default 1.0) 图片显示透明度 |
type |
Type of the shield file, e.g. “png” 图片类型 |
no_text |
(Default “false”) 是否不显示文本 |
unlock_image |
(Default “false) 是否不锁定图片(用于点放置时,图片和文本是否同步对齐) |
样例 |
<Style name="poi_lable"> <Rule> <Filter>([FEATCODE]='2010302')</Filter> <ShieldSymbolizer name="[NAMEC]" face_name="Microsoft YaHei Regular" size="10" avoid_edges="1" fill="rgb(255,0,0)" halo_fill="rgb(255,255,255)" wrap_width="50" wrap_character="/" vertical_alignment="middle" horizontal_alignment="left" dx="-5" dy ="-3" justify_alignment="middle" file="sym_0.png" height="15" type="png" width="15" allow_overlap="0" unlock_image="1"/> </Rule> |
u Filter :用于符号显示的过滤条件,格式如下:
替换 : <variable> and <value>
<Filter>[<variable>] = '<value>'</Filter>
可以使用 and
<Filter>[CARTO] >= 2 and [CARTO] < 5</Filter>
也可以使用 not 或者 or
<Filter>[waterway]='canal' and not ([tunnel] = 'yes' or [tunnel] ='true')</Filter>
另外也可以使用正则表达式,可用来表示 sql 语句中的 like
<Filter>[place] = 'town' and [population].match('[5-9]/d/d/d/d')</Filter>
u ElseFilter :用于设定过滤条件之外的符号
rule 可包含多个 ElseFilter ,以表示不同显示比例下的不同符号显示效果,样例如下:
<Style name="contours">
<Rule>
<Filter>[major] = 1</Filter>
<MaxScaleDenominator>25000</MaxScaleDenominator>
<MinScaleDenominator>100</MinScaleDenominator>
<LineSymbolizer>
<CssParameter name="stroke">#fb9b67</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
<ElseFilter/>
<MaxScaleDenominator>25000</MaxScaleDenominator>
<MinScaleDenominator>5000</MinScaleDenominator>
<LineSymbolizer>
<CssParameter name="stroke">#f45906</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
<ElseFilter/>
<MaxScaleDenominator>5000</MaxScaleDenominator>
<MinScaleDenominator>100</MinScaleDenominator>
<LineSymbolizer>
<CssParameter name="stroke">#f4062A</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
u FontSet :字体集
字体的集合,样例如下
<FontSet name="my-fonts">
<Font face_name="DejaVu Sans Book" />
<Font face_name="TSC FMing S TT Regular" />
</FontSet>
u Datasource :数据源
样例如下:
<Layer name="poi" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>poi_lable</StyleName>
<Datasource>
<Parameter name="encoding">GB2312</Parameter>
<Parameter name="file">F:/Beijng/Poi13</Parameter>
<Parameter name="type">shape</Parameter>
</Datasource>
</Layer>
u 备注:
当 xml 中含有中文字符时,需要设置 xml 文件编码为 gb2312
如 <?xml version="1.0" encoding="utf-8"?>
改成 <?xml version="1.0" encoding="gb2312"?>