springmeyer / geotools2mapnik

Convert SLD into Mapnik XML
15 stars 7 forks source link

SLD Posts #3

Open cschissler opened 13 years ago

cschissler commented 13 years ago

Dane here are two SLD posts as requested. Both have several entities which causes the converter code to choke. I will post them in two separate comments below for you. I usually just find and replace out the "sld:" tag.

Craig

cschissler commented 13 years ago
<?xmlversion="1.0"encoding="UTF-8"?>
<sld:UserStylexmlns="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>MapGeo_State_MA_MajorRoads</sld:Name>
<sld:Title/>
<sld:FeatureTypeStyle>
<sld:Rule>
<sld:Name>StateRoute</sld:Name>
<sld:Title>StateRoute</sld:Title>
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>admin_type</ogc:PropertyName>
<ogc:Literal>3</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<sld:MinScaleDenominator>18057</sld:MinScaleDenominator>
<sld:MaxScaleDenominator>288895</sld:MaxScaleDenominator>
<sld:LineSymbolizer>
<sld:Stroke>
<sld:CssParametername="stroke">
<ogc:Literal>#4E4E4E</ogc:Literal>
</sld:CssParameter>
<sld:CssParametername="stroke-linecap">
<ogc:Literal>butt</ogc:Literal>
</sld:CssParameter>
<sld:CssParametername="stroke-linejoin">
<ogc:Literal>miter</ogc:Literal>
</sld:CssParameter>
<sld:CssParametername="stroke-opacity">
<ogc:Literal>1</ogc:Literal>
</sld:CssParameter>
<sld:CssParametername="stroke-width">
<ogc:Literal>1.5</ogc:Literal>
</sld:CssParameter>
<sld:CssParametername="stroke-dashoffset">
<ogc:Literal>0</ogc:Literal>
</sld:CssParameter>
</sld:Stroke>
</sld:LineSymbolizer>
<sld:TextSymbolizer>
<sld:Label>
<ogc:PropertyNamexmlns="http://www.opengis.net/ogc">rt_number</ogc:PropertyName>
</sld:Label>
<Font>
<CssParametername="font-family">NimbusSansL</CssParameter>
<CssParametername="font-weight">bold</CssParameter>
<CssParametername="font-size">12</CssParameter>
</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:Rotation>
<ogc:Literal>0</ogc:Literal>
</sld:Rotation>
</sld:PointPlacement>
</sld:LabelPlacement>
<Fill>
<CssParametername="fill">#000000</CssParameter>
</Fill>
<Graphic>
<ExternalGraphic>
<OnlineResourcexmlns:xlink="http://www.w3.org/1999/xlink"xlink:type="simple"xlink:href="file:///opt/geoserver/data_dir/MapGeo_Images/MA_Route_blank.svg"/>
<Format>image/svg+xml</Format>
</ExternalGraphic>
<Size>20</Size>
</Graphic>
<VendorOptionname="maxDisplacement">150</VendorOption>
<VendorOptionname="repeat">400</VendorOption>
</sld:TextSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
<sld:FeatureTypeStyle>
<sld:Rule>
<sld:Name>U.S.Highway</sld:Name>
<sld:Title>U.S.Highway</sld:Title>
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>admin_type</ogc:PropertyName>
<ogc:Literal>2</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<sld:MinScaleDenominator>18057</sld:MinScaleDenominator>
<sld:MaxScaleDenominator>288895</sld:MaxScaleDenominator>
<sld:LineSymbolizer>
<sld:Stroke>
<sld:CssParametername="stroke">
<ogc:Literal>#E60000</ogc:Literal>
</sld:CssParameter>
<sld:CssParametername="stroke-linecap">
<ogc:Literal>butt</ogc:Literal>
</sld:CssParameter>
<sld:CssParametername="stroke-linejoin">
<ogc:Literal>miter</ogc:Literal>
</sld:CssParameter>
<sld:CssParametername="stroke-opacity">
<ogc:Literal>1</ogc:Literal>
</sld:CssParameter>
<sld:CssParametername="stroke-width">
<ogc:Literal>1.7</ogc:Literal>
</sld:CssParameter>
<sld:CssParametername="stroke-dashoffset">
<ogc:Literal>0</ogc:Literal>
</sld:CssParameter>
</sld:Stroke>
</sld:LineSymbolizer>
<sld:TextSymbolizer>
<sld:Label>
<ogc:PropertyNamexmlns="http://www.opengis.net/ogc">rt_number</ogc:PropertyName>
</sld:Label>
<Font>
<CssParametername="font-family">NimbusSansL</CssParameter>
<CssParametername="font-weight">bold</CssParameter>
<CssParametername="font-size">12</CssParameter>
</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:Rotation>
<ogc:Literal>0</ogc:Literal>
</sld:Rotation>
</sld:PointPlacement>
</sld:LabelPlacement>
<Fill>
<CssParametername="fill">#000000</CssParameter>
</Fill>
<Graphic>
<ExternalGraphic>
<OnlineResourcexmlns:xlink="http://www.w3.org/1999/xlink"xlink:type="simple"xlink:href="file:///opt/geoserver/data_dir/MapGeo_Images/US_blank.svg"/>
<Format>image/svg+xml</Format>
</ExternalGraphic>
<Size>20</Size>
</Graphic>
<VendorOptionname="maxDisplacement">150</VendorOption>
<VendorOptionname="repeat">400</VendorOption>
</sld:TextSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
<sld:FeatureTypeStyle>
<sld:Name>name</sld:Name>
<sld:FeatureTypeName>Feature</sld:FeatureTypeName>
<sld:SemanticTypeIdentifier>SemanticType[ANY]</sld:SemanticTypeIdentifier>
<sld:Rule>
<sld:Name>Interstate</sld:Name>
<sld:Title>Interstate</sld:Title>
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>admin_type</ogc:PropertyName>
<ogc:Literal>1</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<sld:MinScaleDenominator>18057</sld:MinScaleDenominator>
<sld:MaxScaleDenominator>288895</sld:MaxScaleDenominator>
<sld:LineSymbolizer>
<sld:Stroke>
<sld:CssParametername="stroke">#000000</sld:CssParameter>
<sld:CssParametername="stroke-width">3</sld:CssParameter>
<sld:CssParametername="stroke-opacity">1</sld:CssParameter>
</sld:Stroke>
</sld:LineSymbolizer>
<sld:LineSymbolizer>
<sld:Stroke>
<sld:CssParametername="stroke">#38A800</sld:CssParameter>
<sld:CssParametername="stroke-width">1.5</sld:CssParameter>
<sld:CssParametername="stroke-opacity">1</sld:CssParameter>
</sld:Stroke>
</sld:LineSymbolizer>
<sld:TextSymbolizer>
<Label>
<PropertyNamexmlns="http://www.opengis.net/ogc">rt_number</PropertyName>
</Label>
<Font>
<CssParametername="font-family">NimbusSansL</CssParameter>
<CssParametername="font-weight">bold</CssParameter>
<CssParametername="font-size">11</CssParameter>
</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:Rotation>
<ogc:Literal>0</ogc:Literal>
</sld:Rotation>
</sld:PointPlacement>
</sld:LabelPlacement>
<Fill>
<CssParametername="fill">#FFFFFF</CssParameter>
<CssParametername="fill-opacity">1</CssParameter>
</Fill>
<Graphic>
<ExternalGraphic>
<OnlineResourcexmlns:xlink="http://www.w3.org/1999/xlink"xlink:type="simple"xlink:href="file:///opt/geoserver/data_dir/MapGeo_Images/I-blank.svg"/>
<Format>image/svg+xml</Format>
</ExternalGraphic>
<Size>20</Size>
</Graphic>
<VendorOptionname="maxDisplacement">150</VendorOption>
<VendorOptionname="repeat">400</VendorOption>
</sld:TextSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
<sld:FeatureTypeStyle>
<sld:Rule>
<sld:Name>StateRouteShield</sld:Name>
<sld:Title>StateRouteShield</sld:Title>
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>admin_type</ogc:PropertyName>
<ogc:Literal>3</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<sld:MaxScaleDenominator>18056</sld:MaxScaleDenominator>
<sld:TextSymbolizer>
<sld:Label>
<ogc:PropertyNamexmlns="http://www.opengis.net/ogc">rt_number</ogc:PropertyName>
</sld:Label>
<Font>
<CssParametername="font-family">NimbusSansL</CssParameter>
<CssParametername="font-weight">bold</CssParameter>
<CssParametername="font-size">12</CssParameter>
</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:Rotation>
<ogc:Literal>0</ogc:Literal>
</sld:Rotation>
</sld:PointPlacement>
</sld:LabelPlacement>
<Fill>
<CssParametername="fill">#000000</CssParameter>
</Fill>
<Graphic>
<ExternalGraphic>
<OnlineResourcexmlns:xlink="http://www.w3.org/1999/xlink"xlink:type="simple"xlink:href="file:///opt/geoserver/data_dir/MapGeo_Images/MA_Route_blank.svg"/>
<Format>image/svg+xml</Format>
</ExternalGraphic>
<Size>20</Size>
</Graphic>
<VendorOptionname="maxDisplacement">150</VendorOption>
<VendorOptionname="repeat">400</VendorOption>
</sld:TextSymbolizer>
</sld:Rule>
<sld:Rule>
<sld:Name>U.S.HighwayShield</sld:Name>
<sld:Title>U.S.HighwayShield</sld:Title>
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>admin_type</ogc:PropertyName>
<ogc:Literal>2</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<sld:MaxScaleDenominator>18056</sld:MaxScaleDenominator>
<sld:TextSymbolizer>
<sld:Label>
<ogc:PropertyNamexmlns="http://www.opengis.net/ogc">rt_number</ogc:PropertyName>
</sld:Label>
<Font>
<CssParametername="font-family">NimbusSansL</CssParameter>
<CssParametername="font-weight">bold</CssParameter>
<CssParametername="font-size">12</CssParameter>
</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:Rotation>
<ogc:Literal>0</ogc:Literal>
</sld:Rotation>
</sld:PointPlacement>
</sld:LabelPlacement>
<Fill>
<CssParametername="fill">#000000</CssParameter>
</Fill>
<Graphic>
<ExternalGraphic>
<OnlineResourcexmlns:xlink="http://www.w3.org/1999/xlink"xlink:type="simple"xlink:href="file:///opt/geoserver/data_dir/MapGeo_Images/US_blank.svg"/>
<Format>image/svg+xml</Format>
</ExternalGraphic>
<Size>20</Size>
</Graphic>
<VendorOptionname="maxDisplacement">150</VendorOption>
<VendorOptionname="repeat">400</VendorOption>
</sld:TextSymbolizer>
</sld:Rule>
<sld:Rule>
<sld:Name>InterstateShield</sld:Name>
<sld:Title>InterstateShield</sld:Title>
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>admin_type</ogc:PropertyName>
<ogc:Literal>1</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<sld:MaxScaleDenominator>18056</sld:MaxScaleDenominator>
<sld:TextSymbolizer>
<Label>
<PropertyNamexmlns="http://www.opengis.net/ogc">rt_number</PropertyName>
</Label>
<Font>
<CssParametername="font-family">NimbusSansL</CssParameter>
<CssParametername="font-weight">bold</CssParameter>
<CssParametername="font-size">11</CssParameter>
</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:Rotation>
<ogc:Literal>0</ogc:Literal>
</sld:Rotation>
</sld:PointPlacement>
</sld:LabelPlacement>
<Fill>
<CssParametername="fill">#FFFFFF</CssParameter>
<CssParametername="fill-opacity">1</CssParameter>
</Fill>
<Graphic>
<ExternalGraphic>
<OnlineResourcexmlns:xlink="http://www.w3.org/1999/xlink"xlink:type="simple"xlink:href="file:///opt/geoserver/data_dir/MapGeo_Images/I-blank.svg"/>
<Format>image/svg+xml</Format>
</ExternalGraphic>
<Size>20</Size>
</Graphic>
<VendorOptionname="maxDisplacement">150</VendorOption>
<VendorOptionname="repeat">400</VendorOption>
</sld:TextSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
</sld:UserStyle>
cschissler commented 13 years ago

<?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"&gt; <sld:Name>NantucketMA_SurroundTowns</sld:Name> <sld:Title>NantucketMA_SurroundTowns</sld:Title> <sld:Abstract>A sample style that just draws out a solid gray interior with a black 1px outline</sld:Abstract> <sld:FeatureTypeStyle> <sld:Name>name</sld:Name> <sld:FeatureTypeName>Feature</sld:FeatureTypeName> <sld:SemanticTypeIdentifier>SemanticType[ANY]</sld:SemanticTypeIdentifier> <sld:Rule> <sld:Name>Surrounding Towns</sld:Name> <sld:Title>Surrounding Towns</sld:Title> <ogc:Filter> <ogc:PropertyIsNotEqualTo> <ogc:PropertyName>town</ogc:PropertyName> <ogc:Literal>NANTUCKET</ogc:Literal> </ogc:PropertyIsNotEqualTo> </ogc:Filter> <sld:PolygonSymbolizer> <sld:Fill> <sld:CssParameter name="fill"> <ogc:Literal>#FFFFFF</ogc:Literal> </sld:CssParameter> <sld:CssParameter name="fill-opacity"> <ogc:Literal>.3</ogc:Literal> </sld:CssParameter> </sld:Fill> <sld:Stroke> <sld:CssParameter name="stroke"> <ogc:Literal>#999999</ogc:Literal> </sld:CssParameter> <sld:CssParameter name="stroke-linecap"> <ogc:Literal>butt</ogc:Literal> </sld:CssParameter> <sld:CssParameter name="stroke-linejoin"> <ogc:Literal>miter</ogc:Literal> </sld:CssParameter> <sld:CssParameter name="stroke-opacity"> <ogc:Literal>1</ogc:Literal> </sld:CssParameter> <sld:CssParameter name="stroke-width"> <ogc:Literal>.5</ogc:Literal> </sld:CssParameter> <sld:CssParameter name="stroke-dashoffset"> <ogc:Literal>0</ogc:Literal> </sld:CssParameter> </sld:Stroke> </sld:PolygonSymbolizer> <TextSymbolizer> <Label> <ogc:PropertyName>town</ogc:PropertyName> </Label> <Font> <CssParameter name="font-family">Nimbus Sans L</CssParameter> <CssParameter name="font-size">10</CssParameter> <CssParameter name="font-style">normal</CssParameter> <CssParameter name="font-weight">normal</CssParameter> <CssParameter name="font-spacing">5</CssParameter> </Font> <LabelPlacement> <PointPlacement> <AnchorPoint> <AnchorPointX>0.5</AnchorPointX> <AnchorPointY>0.5</AnchorPointY> </AnchorPoint> </PointPlacement> </LabelPlacement> <Halo> <Radius>1.5</Radius> <Fill> <CssParameter name="fill">#FFFFFF</CssParameter> </Fill> </Halo> <Fill> <CssParameter name="fill">#333333</CssParameter> </Fill> <VendorOption name="group">yes</VendorOption> </TextSymbolizer> </sld:Rule> </sld:FeatureTypeStyle> </sld:UserStyle>

springmeyer commented 13 years ago

heh, these are nasty - nothing like other SLD I have seen. I dare not given an ETA of when I'll have time to poke at this, looks like no fun.

cschissler commented 13 years ago

Haha no not fun at all. Those are about as nasty as they come though. But if we want to give mapnik its day in the sun so to speak, our style sheets will need to be converted. I hope for a day where SLD's are a thing of the past for us=)

No worries. I'll see what I can do as well.