dwins / mapnik2geotools

Using the Scala XML API to translate from Mapnik XML to GeoTools' SLD dialect
64 stars 22 forks source link

Multiple <Style> sections #35

Open drnextgis opened 12 years ago

drnextgis commented 12 years ago

Now each <Style> block in the Mapnik stylesheet is exported as an individual file. What is the purpose of such approach? I guess each <Style> section of Mapnik file should be exported as separate <FeatureTypeStyle> section within one *.sld file.

dwins commented 12 years ago

This approach doesn't work in absolutely all cases. For example, imagine a road map with two classes of roads (local and highway) with each having cladding achieved by rendering the layer twice. The typical approach here is to use four styles: local-cladding, highway-cladding, local, highway. Combining the styles into SLD featuretypestyles wouldn't work well here.

That said, using many layers and styles is bad for performance in GeoServer (compared with using a few layers and complex styles to achieve the same effect.) So there's definitely good room for improvement here. A simple improvement could be to detect places where styles are applied to the same layer multiple times all together and compose those into a single SLD. I've also thought about translating SQL subqueries into SLD filters so that multiple layers backed by the same database table can be combined.