dwins / geoscript.scala

Scala implementation of the GeoScript API
http://geoscript.org/
MIT License
47 stars 14 forks source link

CSS2SLD Multiple issues #37

Closed ghost closed 10 years ago

ghost commented 10 years ago

Hi,

I am trying to convert OpenStreetMap styles from CartoCSS to GeoServer CSS. But the CSS2SLD converter has strange behaviors. It introduces unexpected rules and it doesn't respect the filters as written. Take this exemple in the bottom of this message. If you look carefully at the generated SLD, the converter has introduces the following errors :

1) It has inserted an extra condition on "way_area" for "[@scale < 4000]" 2) It has inserted an extra "MinScaleDenominator" for "[way_area > 19999] [@scale < 8000]" 3) It has inserted an extra "MinScaleDenominator" for "[way_area > 79999] [@scale < 15000]" 4) It has inserted an extra "MinScaleDenominator" for "[way_area > 149999] [@scale < 35000]" 5) It has inserted an extra rule for "[@scale < 4000]"

Could you please fix CSS2SLD in a way it respects provided CSS more accurately ? Because I'm currently blocked. The only exit I have is to abort CSS and use SLD directly, what I want to avoid. Thanks alot.

CartoCSS [way_area >= 150000][zoom >= 14], [way_area >= 80000][zoom >= 15], [way_area >= 20000][zoom >= 16], [zoom >= 17] { text-name: "[name]"; text-size: 11; text-fill: #444; text-face-name: @book-fonts; text-halo-radius: 1; text-wrap-width: 20; text-halo-fill: rgba(255,255,255,0.5); text-placement: interior; }

GeoServer CSS :

[way_area > 149999] [@scale < 35000], [way_area > 79999] [@scale < 15000], [way_area > 19999] [@scale < 8000], [@scale < 4000] { label: [name]; font-family: "DejaVu Sans Book"; font-size: 11; font-fill: #444; halo-radius: 1; halo-color: #FFF; halo-opacity: 0.5; }

Generated SLD :

<?xml version="1.0" encoding="UTF-8"?> sld:NameDefault Styler/sld:Name sld:FeatureTypeStyle sld:Namename/sld:Name sld:Rule ogc:Filter ogc:PropertyIsGreaterThan ogc:PropertyNameway_area/ogc:PropertyName ogc:Literal19999/ogc:Literal /ogc:PropertyIsGreaterThan /ogc:Filter sld:MaxScaleDenominator4000.0/sld:MaxScaleDenominator sld:TextSymbolizer sld:Label ogc:PropertyNamename/ogc:PropertyName /sld:Label sld:Font

DejaVu Sans Book/sld:CssParameter 11/sld:CssParameter normal/sld:CssParameter normal/sld:CssParameter /sld:Font sld:Halo sld:Radius1/sld:Radius sld:Fill #FFFFFF/sld:CssParameter 0.5/sld:CssParameter /sld:Fill /sld:Halo sld:Fill #444444/sld:CssParameter /sld:Fill /sld:TextSymbolizer /sld:Rule sld:Rule ogc:Filter ogc:PropertyIsGreaterThan ogc:PropertyNameway_area/ogc:PropertyName ogc:Literal19999/ogc:Literal /ogc:PropertyIsGreaterThan /ogc:Filter sld:MinScaleDenominator4000.0/sld:MinScaleDenominator sld:MaxScaleDenominator8000.0/sld:MaxScaleDenominator sld:TextSymbolizer sld:Label ogc:PropertyNamename/ogc:PropertyName /sld:Label sld:Font DejaVu Sans Book/sld:CssParameter 11/sld:CssParameter normal/sld:CssParameter normal/sld:CssParameter /sld:Font sld:Halo sld:Radius1/sld:Radius sld:Fill #FFFFFF/sld:CssParameter 0.5/sld:CssParameter /sld:Fill /sld:Halo sld:Fill #444444/sld:CssParameter /sld:Fill /sld:TextSymbolizer /sld:Rule sld:Rule ogc:Filter ogc:PropertyIsGreaterThan ogc:PropertyNameway_area/ogc:PropertyName ogc:Literal79999/ogc:Literal /ogc:PropertyIsGreaterThan /ogc:Filter sld:MinScaleDenominator8000.0/sld:MinScaleDenominator sld:MaxScaleDenominator15000.0/sld:MaxScaleDenominator sld:TextSymbolizer sld:Label ogc:PropertyNamename/ogc:PropertyName /sld:Label sld:Font DejaVu Sans Book/sld:CssParameter 11/sld:CssParameter normal/sld:CssParameter normal/sld:CssParameter /sld:Font sld:Halo sld:Radius1/sld:Radius sld:Fill #FFFFFF/sld:CssParameter 0.5/sld:CssParameter /sld:Fill /sld:Halo sld:Fill #444444/sld:CssParameter /sld:Fill /sld:TextSymbolizer /sld:Rule sld:Rule ogc:Filter ogc:PropertyIsGreaterThan ogc:PropertyNameway_area/ogc:PropertyName ogc:Literal149999/ogc:Literal /ogc:PropertyIsGreaterThan /ogc:Filter sld:MinScaleDenominator15000.0/sld:MinScaleDenominator sld:MaxScaleDenominator35000.0/sld:MaxScaleDenominator sld:TextSymbolizer sld:Label ogc:PropertyNamename/ogc:PropertyName /sld:Label sld:Font DejaVu Sans Book/sld:CssParameter 11/sld:CssParameter normal/sld:CssParameter normal/sld:CssParameter /sld:Font sld:Halo sld:Radius1/sld:Radius sld:Fill #FFFFFF/sld:CssParameter 0.5/sld:CssParameter /sld:Fill /sld:Halo sld:Fill #444444/sld:CssParameter /sld:Fill /sld:TextSymbolizer /sld:Rule sld:Rule ogc:Filter ogc:Not ogc:PropertyIsGreaterThan ogc:PropertyNameway_area/ogc:PropertyName ogc:Literal19999/ogc:Literal /ogc:PropertyIsGreaterThan /ogc:Not /ogc:Filter sld:MaxScaleDenominator4000.0/sld:MaxScaleDenominator sld:TextSymbolizer sld:Label ogc:PropertyNamename/ogc:PropertyName /sld:Label sld:Font DejaVu Sans Book/sld:CssParameter 11/sld:CssParameter normal/sld:CssParameter normal/sld:CssParameter /sld:Font sld:Halo sld:Radius1/sld:Radius sld:Fill #FFFFFF/sld:CssParameter 0.5/sld:CssParameter /sld:Fill /sld:Halo sld:Fill #444444/sld:CssParameter /sld:Fill /sld:TextSymbolizer /sld:Rule /sld:FeatureTypeStyle /sld:UserStyle
dwins commented 10 years ago

It sounds as though you are interested in a totally different tool than CSS2SLD. I don't intend to make this sort of fundamental change in GeoScript Scala, but feel free to use it as a starting point for your own project.

ghost commented 10 years ago

So what is the goal of CSS2SLD ? Did you know that GeoServer is using GeoScript Caja for its CSS extension ?

On Tue, May 13, 2014 at 11:12 AM, David Winslow notifications@github.comwrote:

It sounds as though you are interested in a totally different tool than CSS2SLD. I don't intend to make this sort of fundamental change in GeoScript Scala, but feel free to use it as a starting point for your own project.

— Reply to this email directly or view it on GitHubhttps://github.com/dwins/geoscript.scala/issues/37#issuecomment-42968217 .

ghost commented 10 years ago

See https://jira.codehaus.org/browse/GEOS-6480