在geoserver和Mapinfo中过滤重复显示的标注

作者:lizongbo 发表于:1:06 下午. 星期四, 1月 17th, 2008
版权声明:可以任意转载,转载时请务必以超链接形式标明文章和作者信息及本版权声明

geoserverMapinfo中过滤重复显示的标注
由于国家地理中心提供的地图的问题,在Mapinfogeoserver中,都会显示重复的地名,
比如显示出多个“广东省”,“台湾省”。“海南省”。

解决方法如下:

mapinfo中,
主菜单–>地图–>图层控制–>,选中图层的标注,点“标注”,将“允许文本重复”的钩去掉。

geoserver中,在为地图定义的style里,加上
<sld:VendorOption name=”group”>yes</sld:VendorOption>

修改后片段如下:

[code]

<sld:TextSymbolizer>
<sld:Label>
<ogc:PropertyName>NAME</ogc:PropertyName>
</sld:Label>
<sld:Font>
<sld:CssParameter name=”font-size”>
<ogc:Literal>12.0</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name=”font-style”>
<ogc:Literal>normal</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name=”font-weight”>
<ogc:Literal>normal</ogc:Literal>
</sld:CssParameter>
</sld:Font>
<sld:LabelPlacement>
<sld:PointPlacement>
<sld:AnchorPoint>
<sld:AnchorPointX>
<ogc:Literal>0.5</ogc:Literal>
</sld:AnchorPointX>
<sld:AnchorPointY>
<ogc:Literal>0.5</ogc:Literal>
</sld:AnchorPointY>
</sld:AnchorPoint>
<sld:Displacement>
<sld:DisplacementX>
<ogc:Literal>0</ogc:Literal>
</sld:DisplacementX>
<sld:DisplacementY>
<ogc:Literal>0</ogc:Literal>
</sld:DisplacementY>
</sld:Displacement>
<sld:Rotation>
<ogc:Literal>0.0</ogc:Literal>
</sld:Rotation>
</sld:PointPlacement>
</sld:LabelPlacement>
<sld:Fill>
<sld:CssParameter name=”fill”>
<ogc:Literal>#000000</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name=”fill-opacity”>
<ogc:Literal>1.0</ogc:Literal>
</sld:CssParameter>
</sld:Fill>
<sld:VendorOption name=”spaceAround”>2</sld:VendorOption>
<sld:VendorOption name=”group”>yes</sld:VendorOption>
</sld:TextSymbolizer>
[/code]

我在google是用 “TextSymbolizer duplicate  label”来找到解决这个问题的帖子的。

参考: http://osdir.com/ml/--escaped_anchor:e0dd5e818f3e8b2ef8dfd677654a4540--.geoserver.user/2006-12/msg00013.html
http://osdir.com/ml/--escaped_anchor:e0dd5e818f3e8b2ef8dfd677654a4540--.geoserver.user/2006-12/msg00008.html
http://postgis.refractions.net/pipermail/postgis-users/2007-November/017846.html

sld的 schema文件在:  http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd

本地目录在: \geoserver\schemas\sld\StyledLayerDescriptor.xsd

补记一下,geoserver-1.6.0-RC2-war.zip中自带的OpenLayers.js貌似版本要低些,

在使用LonLat时有出错信息,
例如:             map.setCenter(new OpenLayers.LonLat(114, 22.54), 4);

于是我直接用OpenLayers-2.5.zip 中的OpenLayers替换geoserver\openlayers下面的文件,就不再出错了。

Tags: geoserver, gis, MapInfo, OpenLayers

Related posts

Tags: , , ,

recent related 12 searches :

本文发表于 on 星期四, 1月 17th, 2008 at 1:06 下午 and is filed under Java. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

One Response to “在geoserver和Mapinfo中过滤重复显示的标注”

  1. 一农 说:

    yes
    这个问题也困扰我好长时间,多谢。

    [Reply]

Leave a Reply