[Geoserver-users] Possible bug in GeoServer CSS plugin

Hi,
I'm using GeoServer 2.0.2 together with the CSS plugin (nightly build
downloaded 8th of august). I've deployed this in Tomcat 6.0.29 under
Windows.

I'm trying to style a road network based on the scale of the map, so
that some road types are only shown when zoomed in, etc.

Here's the outline of the CSS (stripped the details since I'm guessing
they aren't relevant):

/* @title 5011 - motorvag */
[KKOD = 5011] {
  ...
}

/* @title motorvag-text */
[KKOD = 5011][@scale<3000000] {
  label: [VAGNR1];
  ...
}
/* @title 5213 - allman vag */
[KKOD = 5213][@scale<2000000] {
  ...
}

/* @title allman vag-text */
[KKOD = 5213][@scale<500000] {
  label: [VAGNR1];
  ...
}

What I want to accomplish is:
  * KKOD 5011 should always be shown
  * Labels for KKOD 5011 should be shown if scale is less than 3,000,000
  * KKOD 5213 should be should if scale is less than 2,000,000
  * Labels for KKOD 5213 should be shown if scale is less than 500,000

But this CSS is turned into an SLD which shows *all* roads, regardless
of KKOD, at scales lower than 2,000,000 but rendered as if they had
KKOD 5213. I think the problematic SLD rule that is generated is:

<sld:Rule>
      <sld:Title>5213 - allman vag </sld:Title>
      <sld:MaxScaleDenominator>2000000.0</sld:MaxScaleDenominator>
      <sld:LineSymbolizer>
        <sld:Stroke>
          <sld:CssParameter name="stroke">#DDD8C7</sld:CssParameter>
        </sld:Stroke>
      </sld:LineSymbolizer>
</sld:Rule>

For some reason, the KKOD conditional I specified in the CSS isn't in the SLD.

Is this a bug, or am I misunderstanding how the CSS selectors are
supposed to work? How should I go about accomplishing the desired
results I describe above?

I really like the CSS way of designing, since it's so much more
compact than the annoyingly verbose SLD, but this issue really
prevents me from switching to CSS.

Best regards,
Per Liedman

--
Per Liedman
Software Engineer
Kartena AB
per.liedman@anonymised.com
http://www.kartena.se
031 - 77 44 397

The CSS plugin is still in kind of an experimental state and hasn’t seen a lot of field usage, so I am sure there are some show-stopping bugs there. This is a bug though, your style should be working like you said (assuming that your style has only the rules you mentioned in your mail.) I created an issue on JIRA to track this: http://jira.codehaus.org/browse/GEOS-4099 ; you can register there for updates if you like.


David Winslow
OpenGeo - http://opengeo.org/

On Thu, Aug 12, 2010 at 10:06 AM, Per Liedman <per.liedman@anonymised.com> wrote:

Hi,
I’m using GeoServer 2.0.2 together with the CSS plugin (nightly build
downloaded 8th of august). I’ve deployed this in Tomcat 6.0.29 under
Windows.

I’m trying to style a road network based on the scale of the map, so
that some road types are only shown when zoomed in, etc.

Here’s the outline of the CSS (stripped the details since I’m guessing
they aren’t relevant):

/* @title 5011 - motorvag */
[KKOD = 5011] {

}

/* @title motorvag-text /
[KKOD = 5011][@scale<3000000] {
label: [VAGNR1];

}
/
@title 5213 - allman vag */
[KKOD = 5213][@scale<2000000] {

}

/* @title allman vag-text */
[KKOD = 5213][@scale<500000] {
label: [VAGNR1];

}

What I want to accomplish is:

  • KKOD 5011 should always be shown
  • Labels for KKOD 5011 should be shown if scale is less than 3,000,000
  • KKOD 5213 should be should if scale is less than 2,000,000
  • Labels for KKOD 5213 should be shown if scale is less than 500,000

But this CSS is turned into an SLD which shows all roads, regardless
of KKOD, at scales lower than 2,000,000 but rendered as if they had
KKOD 5213. I think the problematic SLD rule that is generated is:

sld:Rule
sld:Title5213 - allman vag </sld:Title>
sld:MaxScaleDenominator2000000.0</sld:MaxScaleDenominator>
sld:LineSymbolizer
sld:Stroke
<sld:CssParameter name=“stroke”>#DDD8C7</sld:CssParameter>
</sld:Stroke>
</sld:LineSymbolizer>
</sld:Rule>

For some reason, the KKOD conditional I specified in the CSS isn’t in the SLD.

Is this a bug, or am I misunderstanding how the CSS selectors are
supposed to work? How should I go about accomplishing the desired
results I describe above?

I really like the CSS way of designing, since it’s so much more
compact than the annoyingly verbose SLD, but this issue really
prevents me from switching to CSS.

Best regards,
Per Liedman


Per Liedman
Software Engineer
Kartena AB
per.liedman@anonymised.com
http://www.kartena.se
031 - 77 44 397


This SF.net email is sponsored by

Make an app they can’t live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev


Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

I’ve just updated the CSS module to a newer version which should address this issue (a number of other bugfixes and performance improvements are rolled in as well). The 2.0.x nightly build should already be available; the one for trunk will be available soon.

Please note that this update also includes a newer version of scala-library.jar, so you will need to delete the previous version as part of the upgrade process.


David Winslow
OpenGeo - http://opengeo.org/

On Thu, Aug 12, 2010 at 10:25 AM, David Winslow <dwinslow@anonymised.com> wrote:

The CSS plugin is still in kind of an experimental state and hasn’t seen a lot of field usage, so I am sure there are some show-stopping bugs there. This is a bug though, your style should be working like you said (assuming that your style has only the rules you mentioned in your mail.) I created an issue on JIRA to track this: http://jira.codehaus.org/browse/GEOS-4099 ; you can register there for updates if you like.


David Winslow
OpenGeo - http://opengeo.org/

On Thu, Aug 12, 2010 at 10:06 AM, Per Liedman <per.liedman@anonymised.com> wrote:

Hi,
I’m using GeoServer 2.0.2 together with the CSS plugin (nightly build
downloaded 8th of august). I’ve deployed this in Tomcat 6.0.29 under
Windows.

I’m trying to style a road network based on the scale of the map, so
that some road types are only shown when zoomed in, etc.

Here’s the outline of the CSS (stripped the details since I’m guessing
they aren’t relevant):

/* @title 5011 - motorvag */
[KKOD = 5011] {

}

/* @title motorvag-text /
[KKOD = 5011][@scale<3000000] {
label: [VAGNR1];

}
/
@title 5213 - allman vag */
[KKOD = 5213][@scale<2000000] {

}

/* @title allman vag-text */
[KKOD = 5213][@scale<500000] {
label: [VAGNR1];

}

What I want to accomplish is:

  • KKOD 5011 should always be shown
  • Labels for KKOD 5011 should be shown if scale is less than 3,000,000
  • KKOD 5213 should be should if scale is less than 2,000,000
  • Labels for KKOD 5213 should be shown if scale is less than 500,000

But this CSS is turned into an SLD which shows all roads, regardless
of KKOD, at scales lower than 2,000,000 but rendered as if they had
KKOD 5213. I think the problematic SLD rule that is generated is:

sld:Rule
sld:Title5213 - allman vag </sld:Title>
sld:MaxScaleDenominator2000000.0</sld:MaxScaleDenominator>
sld:LineSymbolizer
sld:Stroke
<sld:CssParameter name=“stroke”>#DDD8C7</sld:CssParameter>
</sld:Stroke>
</sld:LineSymbolizer>
</sld:Rule>

For some reason, the KKOD conditional I specified in the CSS isn’t in the SLD.

Is this a bug, or am I misunderstanding how the CSS selectors are
supposed to work? How should I go about accomplishing the desired
results I describe above?

I really like the CSS way of designing, since it’s so much more
compact than the annoyingly verbose SLD, but this issue really
prevents me from switching to CSS.

Best regards,
Per Liedman


Per Liedman
Software Engineer
Kartena AB
per.liedman@anonymised.com3353…
http://www.kartena.se
031 - 77 44 397


This SF.net email is sponsored by

Make an app they can’t live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev


Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users