Variable substitution for a pie chart, and symbol() vs url() for charting

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Variable substitution for a pie chart, and symbol() vs url() for charting

shepthedog

Hi all,

 

I am trying to symbolise with a pie chart where the end user picks the attributes to use at run time, in Geoserver 2.12.2. The chart works OK for hard-wired attributes:

 

  mark: url("http://chart?cht=p3&chs=225x75&chf=bg,s,FFFFFF00&chl=car|HGV|LGV&chd=t:${_am_dest_car},${_am_dest_hgv},${_am_dest_lgv}&chco=0000ff");

 

…but my first experiment with variable substitution fails:

 

  mark: url(strConcat("http://chart", "?cht=p3"));

 

·        Cannot turn this value into a literal: Function [name=strConcat, parameters=[Literal[http://chart], Literal[?cht=p3]]]

 

This syntax does pass validation if I use ‘symbol’ instead of ‘url’:

 

  mark: symbol(strConcat("http://chart", "?cht=p3"));

 

…but I can’t figure out what the string contents should be for symbol(). Even without trying to substitute anything I can’t get any pies to render using symbol().

The only example I have found is https://docs.geoserver.org/stable/en/user/styling/css/valuetypes.html

    mark: symbol("chart://type=pie&x&y&z");

I have tried my original string and a simplified version:

  mark: url("http://chart?cht=p3&chd=t:${_am_dest_car},${_am_dest_hgv},${_am_dest_lgv");

 

I have tried guessing that “&x&y&z” might be asking for attribute names:

  mark: symbol("chart://type=pie&_am_dest_car&_am_dest_hgv&_am_dest_lgv");

 

.. but they don’t render anything.

 

Can anyone tell me how to use symbol() to show charts?

 

Does anyone have any suggestions on substituting attribute names for charting?

 

Thanks!

 

Ian Sheppard

GIS Developer, Smart Consulting

 

../../../_New%20Visual%20Identity/Templates/Email%20Signature/wsp_RGB.png



_______________________________________________
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

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


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

Re: Variable substitution for a pie chart, and symbol() vs url() for charting

geowolf
Hi Ian,
building a char URL with variables in CSS follows the same rules as SLD, so:
  • use external graphic, in other words, url, not symbol
  • put the expressions between $ signs
You are talking about "variable substitution", but your first URL is already using property names... do you mean to change them at runtime
using WMS environment variables? If so, the URL would have to be something like:

 mark: url("<a href="http://chart?cht=p3&amp;chs=225x75&amp;chf=bg,s,FFFFFF00&amp;chl=car|HGV|LGV&amp;chd=t:${property(env(&#39;x">http://chart?cht=p3&chs=225x75&chf=bg,s,FFFFFF00&chl=car|HGV|LGV&chd=t:${property(env('x','_am_dest_car'))},${property(env('y','_am_dest_hgv'))},${property(env('z','_am_dest_lgv'))}&chco=0000ff");

and then you can pass down the values of x, y, and z from the request URL adding something like:

"...&env=x:att1;y:att2;z:att3"


Cheers
Andrea

On Tue, Mar 12, 2019 at 5:38 PM Sheppard, Ian <[hidden email]> wrote:

Hi all,

 

I am trying to symbolise with a pie chart where the end user picks the attributes to use at run time, in Geoserver 2.12.2. The chart works OK for hard-wired attributes:

 

  mark: url("http://chart?cht=p3&chs=225x75&chf=bg,s,FFFFFF00&chl=car|HGV|LGV&chd=t:${_am_dest_car},${_am_dest_hgv},${_am_dest_lgv}&chco=0000ff");

 

…but my first experiment with variable substitution fails:

 

  mark: url(strConcat("http://chart", "?cht=p3"));

 

·        Cannot turn this value into a literal: Function [name=strConcat, parameters=[Literal[http://chart], Literal[?cht=p3]]]

 

This syntax does pass validation if I use ‘symbol’ instead of ‘url’:

 

  mark: symbol(strConcat("http://chart", "?cht=p3"));

 

…but I can’t figure out what the string contents should be for symbol(). Even without trying to substitute anything I can’t get any pies to render using symbol().

The only example I have found is https://docs.geoserver.org/stable/en/user/styling/css/valuetypes.html

    mark: symbol("chart://type=pie&x&y&z");

I have tried my original string and a simplified version:

  mark: url("http://chart?cht=p3&chd=t:${_am_dest_car},${_am_dest_hgv},${_am_dest_lgv");

 

I have tried guessing that “&x&y&z” might be asking for attribute names:

  mark: symbol("chart://type=pie&_am_dest_car&_am_dest_hgv&_am_dest_lgv");

 

.. but they don’t render anything.

 

Can anyone tell me how to use symbol() to show charts?

 

Does anyone have any suggestions on substituting attribute names for charting?

 

Thanks!

 

Ian Sheppard

GIS Developer, Smart Consulting

 

../../../_New%20Visual%20Identity/Templates/Email%20Signature/wsp_RGB.png

_______________________________________________
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

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[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 ------------------------------------------------------- Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.



_______________________________________________
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

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


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