Skip to content

Instantly share code, notes, and snippets.

@dwins
Created June 25, 2013 15:59
Show Gist options
  • Save dwins/5859680 to your computer and use it in GitHub Desktop.
Save dwins/5859680 to your computer and use it in GitHub Desktop.
* {
/* "defaults;" these properties may be overridden by more specific rules */
label: [PROPERTY];
label-anchor: 0 1;
}
[ANCHOR_PT IN (1, 3, 6)] {
label-anchor: 0 0;
}
[ANCHOR_PT IN (2, 4, 7)] {
label-anchor: 0 0.5;
}
<?xml version="1.0" encoding="UTF-8"?>
<sld:UserStyle xmlns="http://www.opengis.net/sld" xmlns:sld="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml">
<sld:Name>Default Styler</sld:Name>
<sld:Title/>
<sld:FeatureTypeStyle>
<sld:Name>name</sld:Name>
<sld:Rule>
<ogc:Filter>
<ogc:And>
<ogc:Not>
<ogc:Or>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>ANCHOR_PT</ogc:PropertyName>
<ogc:Literal>6</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>ANCHOR_PT</ogc:PropertyName>
<ogc:Literal>3</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>ANCHOR_PT</ogc:PropertyName>
<ogc:Literal>1</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Or>
</ogc:Not>
<ogc:Not>
<ogc:Or>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>ANCHOR_PT</ogc:PropertyName>
<ogc:Literal>7</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>ANCHOR_PT</ogc:PropertyName>
<ogc:Literal>4</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>ANCHOR_PT</ogc:PropertyName>
<ogc:Literal>2</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Or>
</ogc:Not>
</ogc:And>
</ogc:Filter>
<sld:TextSymbolizer>
<sld:Label>
<ogc:PropertyName>PROPERTY</ogc:PropertyName>
</sld:Label>
<sld:LabelPlacement>
<sld:PointPlacement>
<sld:AnchorPoint>
<sld:AnchorPointX>0.0</sld:AnchorPointX>
<sld:AnchorPointY>1.0</sld:AnchorPointY>
</sld:AnchorPoint>
</sld:PointPlacement>
</sld:LabelPlacement>
<sld:Fill/>
</sld:TextSymbolizer>
</sld:Rule>
<sld:Rule>
<ogc:Filter>
<ogc:Or>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>ANCHOR_PT</ogc:PropertyName>
<ogc:Literal>7</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>ANCHOR_PT</ogc:PropertyName>
<ogc:Literal>4</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>ANCHOR_PT</ogc:PropertyName>
<ogc:Literal>2</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Or>
</ogc:Filter>
<sld:TextSymbolizer>
<sld:Label>
<ogc:PropertyName>PROPERTY</ogc:PropertyName>
</sld:Label>
<sld:LabelPlacement>
<sld:PointPlacement>
<sld:AnchorPoint>
<sld:AnchorPointX>0.0</sld:AnchorPointX>
<sld:AnchorPointY>0.5</sld:AnchorPointY>
</sld:AnchorPoint>
</sld:PointPlacement>
</sld:LabelPlacement>
<sld:Fill/>
</sld:TextSymbolizer>
</sld:Rule>
<sld:Rule>
<ogc:Filter>
<ogc:Or>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>ANCHOR_PT</ogc:PropertyName>
<ogc:Literal>6</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>ANCHOR_PT</ogc:PropertyName>
<ogc:Literal>3</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>ANCHOR_PT</ogc:PropertyName>
<ogc:Literal>1</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Or>
</ogc:Filter>
<sld:TextSymbolizer>
<sld:Label>
<ogc:PropertyName>PROPERTY</ogc:PropertyName>
</sld:Label>
<sld:LabelPlacement>
<sld:PointPlacement>
<sld:AnchorPoint>
<sld:AnchorPointX>0.0</sld:AnchorPointX>
<sld:AnchorPointY>0.0</sld:AnchorPointY>
</sld:AnchorPoint>
</sld:PointPlacement>
</sld:LabelPlacement>
<sld:Fill/>
</sld:TextSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
</sld:UserStyle>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment