[Geoserver-users] Variable substitution in CSS styling?

I’d like to declare variables, and use them later on in the styles - something like


/* Declare color scheme */
@primary: #E4E4E4
(…other declarations…)

[highway=‘primary’]

[@scale < 15000000][@scale > 1600000] {
stroke: @primary
(…)
}

[highway=‘primary’]
[@scale < 1600000][@scale > 80000] {
stroke: @primary
(…)
}

[highway=‘primary’]
[@scale < 80000][@scale > 4000] {
stroke: @primary
(…)
}


I realize in this specific case cascading would cover my use case, but there are use cases where cascading doesn’t work, but I still want to maintain a reference. (Color palette’s are my use case for this - though there may be others).

I use this in CartoCSS all the time - just trying to find a good analogue in GeoServer’s CSS.

On Sun, Mar 23, 2014 at 2:54 PM, Chris Bennight <chris@anonymised.com> wrote:

I'd like to declare variables, and use them later on in the styles -
something like

------------------------------------------------
/* Declare color scheme */
@primary: #E4E4E4
(...other declarations...)

[highway='primary']
[@scale < 15000000][@scale > 1600000] {
     stroke: @primary
     (....)
}

[highway='primary']
[@scale < 1600000][@scale > 80000] {
     stroke: @primary
     (...)
}

[highway='primary']
[@scale < 80000][@scale > 4000] {
     stroke: @primary
     (...)
}
------------------------------------------------

I realize in this specific case cascading would cover my use case, but
there are use cases where cascading doesn't work, but I still want to
maintain a reference. (Color palette's are my use case for this - though
there may be others).

I use this in CartoCSS all the time - just trying to find a good analogue
in GeoServer's CSS.

I'm afraid there is no such equivalent, at least at the time of writing,
althought this would be of course a
welcomed improvement

Cheers
Andrea

--

Meet us at GEO Business 2014! in London! Visit http://goo.gl/fES3aK
for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------