ITeye博客

GeoServer中多边形内多个标签问题

cjx186 · 2012-08-29 01:25 · gis · 开源软件 · Markdown

GeoServer在生成多边形切片时会产生重复标签 这个问题可以使用过滤器的质心功能,中心位置。

|Name|Arguments|Description| |centroid|geometry:Geometry|Returns the centroid of the geometry. Can be often used as a label point for polygons, though there is no guarantee it will actually lie inside the geometry|


<Rule>
  <TextSymbolizer>
    <Label><ogc:PropertyName>NAME</ogc:PropertyName></Label>
    <Fill><CssParameter name="fill">#666666</CssParameter></Fill>
    <Geometry>
      <ogc:Function name="centroid">
        <ogc:PropertyName>geom</ogc:PropertyName>
      </ogc:Function>
    </Geometry>
    <VendorOption name="spaceAround">10</VendorOption>
    <VendorOption name="autoWrap">85</VendorOption>
    <VendorOption name="group">yes</VendorOption>
  </TextSymbolizer>
</Rule>

使用后如下效果 但声明时没有保证一定在多边形内部有可能出现如下效果(需要注意):

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。