CSS styling stroke-width with expression and meters

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

CSS styling stroke-width with expression and meters

Michel Wortmann

Dear list,

I have a problem styling a line vector according to an attribute value (ac_average). I'm trying to set the stroke-width like this:

/* @title red line */
* {
    stroke: #ff3300;
    stroke-width: [ 0.00001m * ac_average];
}

However the m for meter seems to cause problems, as it works without the m and just 1000m (no expression) also works. What am I missing? The documentation (http://docs.geoserver.org/stable/en/user/styling/css/valuetypes.html) explains that this should work: "When using expressions in place of numeric values, the first unit listed for the type of measure is assumed."

A related question, is it possible to use power (** or ^) in these expressions? I was unable to find a reference as to what is possible here or not.

Working with the stable Geoserver version (2.12.1).

Thanks a lot,

Michel


  


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Reply | Threaded
Open this post in threaded view
|

Re: CSS styling stroke-width with expression and meters

geowolf
Hi Michael,
I've checked and indeed it does not seem to be possible. For sure the syntax you used cannot work
as CQL is not unit aware, but I was hoping something like this would:

stroke-width: [0.001 * PERSONS]m;

but it fails to parse. Could you open a bug report about it

In the meantime you can use this work around:

/* @title red line */
* {
    stroke: #ff3300;
    stroke-width: [Concatenate(0.001 * PERSONS, 'm')];
}

Tested against topp:states seems to work:

Inline image 1

Cheers
Andrea


On Fri, Dec 1, 2017 at 12:47 PM, Michel Wortmann <[hidden email]> wrote:

Dear list,

I have a problem styling a line vector according to an attribute value (ac_average). I'm trying to set the stroke-width like this:

/* @title red line */
* {
    stroke: #ff3300;
    stroke-width: [ 0.00001m * ac_average];
}

However the m for meter seems to cause problems, as it works without the m and just 1000m (no expression) also works. What am I missing? The documentation (http://docs.geoserver.org/stable/en/user/styling/css/valuetypes.html) explains that this should work: "When using expressions in place of numeric values, the first unit listed for the type of measure is assumed."

A related question, is it possible to use power (** or ^) in these expressions? I was unable to find a reference as to what is possible here or not.

Working with the stable Geoserver version (2.12.1).

Thanks a lot,

Michel


  

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users




--

Regards,

Andrea Aime

==
GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information.
==

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39  339 8844549

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

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility  for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Reply | Threaded
Open this post in threaded view
|

Re: CSS styling stroke-width with expression and meters

Michel Wortmann
Dear Andrea,
Thank you for looking into this. Your work around works nicely, thanks. I have opened a bug report here: https://osgeo-org.atlassian.net/browse/GEOS-8481

Thank you and best regards,
Michel

On 7. Dec 2017, at 19:48, Andrea Aime <[hidden email]> wrote:

Hi Michael,
I've checked and indeed it does not seem to be possible. For sure the syntax you used cannot work
as CQL is not unit aware, but I was hoping something like this would:

stroke-width: [0.001 * PERSONS]m;

but it fails to parse. Could you open a bug report about it

In the meantime you can use this work around:

/* @title red line */
* {
    stroke: #ff3300;
    stroke-width: [Concatenate(0.001 * PERSONS, 'm')];
}

Tested against topp:states seems to work:

<image.png>

Cheers
Andrea


On Fri, Dec 1, 2017 at 12:47 PM, Michel Wortmann <[hidden email]> wrote:

Dear list,

I have a problem styling a line vector according to an attribute value (ac_average). I'm trying to set the stroke-width like this:

/* @title red line */
* {
    stroke: #ff3300;
    stroke-width: [ 0.00001m * ac_average];
}

However the m for meter seems to cause problems, as it works without the m and just 1000m (no expression) also works. What am I missing? The documentation (http://docs.geoserver.org/stable/en/user/styling/css/valuetypes.html) explains that this should work: "When using expressions in place of numeric values, the first unit listed for the type of measure is assumed."

A related question, is it possible to use power (** or ^) in these expressions? I was unable to find a reference as to what is possible here or not.

Working with the stable Geoserver version (2.12.1).

Thanks a lot,

Michel


  

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users




--
Regards,
Andrea Aime
==
GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information.
==

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39  339 8844549

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

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility  for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users