enable label collision-management in sld context
Peter Freimuth
pf at MAPMEDIA.DE
Sat Jan 14 19:39:34 EST 2006
Hi Mapserver Development Team,
in a currently running project we have the urgent need to use SLD
Filtering and Symbolising in a WMS Get Map Request. But the problem is
that mapservers label collision management cannot be used via SLD,
because it is not part of the specs and so not supported by umn's sld
interface. So what do you think about -1 and -1 as AnchorPoint values
which has the same effect than POSITION=AUTO in the Mapfile. I think a
lot of people would like to have this feature enabled, even if it is not
written in the OGC SLD specs.
Example:
<TextSymbolizer>
<Geometry>
<ogc:PropertyName>GEOM</ogc:PropertyName>
</Geometry>
<Label>
<ogc:PropertyName>NAME</ogc:PropertyName>
</Label>
<Font>
<CssParameter name="font-family">Arial</CssParameter>
<CssParameter name="font-family">Sans-Serif</CssParameter>
<CssParameter name="font-style">italic</CssParameter>
<CssParameter name="font-size">10</CssParameter>
<CssParameter name="font-color">#222222</CssParameter>
</Font>
<LabelPlacement>
<AnchorPointX>-1</AnchorPointX>
/<AnchorPointY>-1</AnchorPointY>
would be equal to /<PointPlacement auto="true"/> which can be used in
GeoServer for example
</LabelPlacement>
...
</TextSymbolizer>
and handle this in:
void ParseTextPointPlacement(CPLXMLNode *psRoot, classObj *psClass)
...
if ((dfAnchorX == 0 || dfAnchorX == 0.5 || dfAnchorX ==
1) &&
(dfAnchorY == 0 || dfAnchorY == 0.5 || dfAnchorY == 1))
{
if (dfAnchorX == 0 && dfAnchorY == 0)
psClass->label.position = MS_LL;
if (dfAnchorX == 0 && dfAnchorY == 0.5)
psClass->label.position = MS_CL;
if (dfAnchorX == 0 && dfAnchorY == 1)
psClass->label.position = MS_UL;
if (dfAnchorX == 0.5 && dfAnchorY == 0)
psClass->label.position = MS_LC;
if (dfAnchorX == 0.5 && dfAnchorY == 0.5)
psClass->label.position = MS_CC;
if (dfAnchorX == 0.5 && dfAnchorY == 1)
psClass->label.position = MS_UC;
if (dfAnchorX == 1 && dfAnchorY == 0)
psClass->label.position = MS_LR;
if (dfAnchorX == 1 && dfAnchorY == 0.5)
psClass->label.position = MS_CR;
if (dfAnchorX == 1 && dfAnchorY == 1)
psClass->label.position = MS_UR;
if (dfAnchorX == -1 && dfAnchorY == -1)
psClass->label.position = MS_AUTO;
}
This will still be conform with the specs and give us the possibility to
use mapserver label intelligence with sld's.
Best regards,
Peter
--
Mit freundlichem Gruß
Peter Freimuth
MapMedia
Kartographie und raumbezogene Informationssysteme
Heilbronner Straße 10
D-10711 Berlin Charlottenburg
fon: +49.(0)30.89 06 82 70
fax: +49.(0)30.89 06 82 73
mail: pf at mapmedia.de
net: www.mapmedia.de
pgp: on demand
_________________________________________________
More information about the mapserver-dev
mailing list