来自http://geoserver.org/display/GEOSDOC/LabelingOptions
Controlling Label Placement(控制标签位置)
1.Basic SLD Placement
1.1Point Geometries ("PointPlacement")
1.2Linear (line) geometries ("LinePlacement")
[b]a.AnchorPoint[/b]
[b]b.Displacement[/b]
c.Rotation(旋转角度)
d.LinePlacement
[b]2.Priority Labeling [/b]
根据人口来区分标签的级别 如果有冲突 高级别的会覆盖低级别的
City Name | population
-------------+------------
Yonkers | 197,818
Jersey City | 237,681
Newark | 280,123
New York | 8,107,916
[b]3.Grouping Geometries(<VendorOption name="group">)分组显示[/b]
[table]
|[b]Geometry[/b]|[b]Representative Geometry[/b]
|Point Set|first point inside the view rectangle is used.
|Line Set|lines are (a) networked together (b) clipped to the view rectangle (c) middle of the longest network path is used.
|Polygon Set|polygons are (a) clipped to the view rectangle (b) the centroid of the largest polygon is used.
[/table]
[b]4.Overlapping and Separating Labels (<VendorOption name="spaceAround">)[/b]
By default geoserver will not put labels "on top of each other". By using the spaceAround option you can allow overlaps to overlap and you can also add extra space around a label.
......
Controlling Label Placement(控制标签位置)
1.Basic SLD Placement
1.1Point Geometries ("PointPlacement")
1.2Linear (line) geometries ("LinePlacement")
<xsd:element name="PointPlacement">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="sld:AnchorPoint" minOccurs="0"/>--(a)
<xsd:element ref="sld:Displacement" minOccurs="0"/>--(b)
<xsd:element ref="sld:Rotation" minOccurs="0"/>--(c)
</xsd:sequence>
</xsd:complexType>
</xsd:element>
...
<xsd:element name="LinePlacement">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="sld:PerpendicularOffset" minOccurs="0"/>--(d)
</xsd:sequence>
</xsd:complexType>
</xsd:element>
[b]a.AnchorPoint[/b]
<PointPlacement>
<AnchorPoint>
<AnchorPointX>
0.5
</AnchorPointX>
<AnchorPointY>
0.5
</AnchorPointY>
</AnchorPoint>
</PointPlacement>
[b]b.Displacement[/b]
<PointPlacement>
<Displacement>
<DisplacementX>
10--X的偏移值
</DisplacementX>
<DisplacementY>
0--Y的偏移值
</DisplacementY>
</Displacement>
</PointPlacement>
c.Rotation(旋转角度)
<Rotation>
45
</Rotation>
d.LinePlacement
<LabelPlacement>
<LinePlacement>
<PerpendicularOffset>
10
</PerpendicularOffset>
</LinePlacement>
</LabelPlacement>
[b]2.Priority Labeling [/b]
根据人口来区分标签的级别 如果有冲突 高级别的会覆盖低级别的
City Name | population
-------------+------------
Yonkers | 197,818
Jersey City | 237,681
Newark | 280,123
New York | 8,107,916
<Priority>
<PropertyName>population</PropertyName>
</Priority>
[b]3.Grouping Geometries(<VendorOption name="group">)分组显示[/b]
[table]
|[b]Geometry[/b]|[b]Representative Geometry[/b]
|Point Set|first point inside the view rectangle is used.
|Line Set|lines are (a) networked together (b) clipped to the view rectangle (c) middle of the longest network path is used.
|Polygon Set|polygons are (a) clipped to the view rectangle (b) the centroid of the largest polygon is used.
[/table]
<VendorOption name="group">yes</VendorOption>
[b]4.Overlapping and Separating Labels (<VendorOption name="spaceAround">)[/b]
By default geoserver will not put labels "on top of each other". By using the spaceAround option you can allow overlaps to overlap and you can also add extra space around a label.
<VendorOption name="spaceAround">10</VendorOption>
......