Created
December 16, 2010 15:14
-
-
Save dwins/743506 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val orig = xml.XML.load("OSM_Roads.sld") | |
val ftypes = orig \\ "FeatureTypeStyle" | |
val printer = new xml.PrettyPrinter(80, 2) | |
for (name <- Seq("railway", "aeroway", "highway")) { | |
val nodes = | |
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"> | |
<UserStyle> | |
<FeatureTypeStyle> | |
{ ftypes.filter { _ \\ "Filter" \\ "PropertyName" forall(_.text == name) } flatMap (_ \\ "Rule") } | |
</FeatureTypeStyle> | |
</UserStyle> | |
</StyledLayerDescriptor> | |
val writer = new java.io.FileWriter(name + "s.sld") | |
writer.write(printer.format(nodes)) | |
writer.close() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment