[Geoserver-users] Windbarbs preview legend error

Hi,

I'm using windbarbs with following definition:

<WellKnownName>windbarbs://default(<ogc:PropertyName>speed</ogc:PropertyName>)[m/s]</WellKnownName>

Everything works as expected except the "Preview legend" command that throws an error:

ERROR [wicket.RequestCycle] - The specified mark
strConcat([strConcat([windbarbs://default(], [speed])], [)[m/s]]) was not found!

Any ideas?

Regards

Maciej

2015-10-01 09:47:21,238 ERROR [wicket.RequestCycle] - The specified mark strConcat([strConcat([windbarbs://default(], [speed])], [)[m/s]]) was not found!
java.lang.IllegalArgumentException: The specified mark strConcat([strConcat([windbarbs://default(], [speed])], [)[m/s]]) was not found!
         at org.geotools.renderer.style.SLDStyleFactory.createMarkStyle(SLDStyleFactory.java:747)
         at org.geotools.renderer.style.SLDStyleFactory.createPointStyle(SLDStyleFactory.java:711)
         at org.geotools.renderer.style.SLDStyleFactory.createPointStyle(SLDStyleFactory.java:576)
         at org.geotools.renderer.style.SLDStyleFactory.createStyleInternal(SLDStyleFactory.java:415)
         at org.geotools.renderer.style.SLDStyleFactory.createStyle(SLDStyleFactory.java:362)
         at org.geoserver.wms.legendgraphic.BufferedImageLegendGraphicBuilder.buildLegendGraphic(BufferedImageLegendGraphicBuilder.java:400)
         at org.geoserver.wms.web.data.AbstractStylePage$7$1.getData(AbstractStylePage.java:303)
         at org.apache.wicket.markup.html.DynamicWebResource$ResourceState.getLength(DynamicWebResource.java:89)
         at org.apache.wicket.markup.html.DynamicWebResource$1.length(DynamicWebResource.java:241)
         at org.apache.wicket.request.target.resource.ResourceStreamRequestTarget.configure(ResourceStreamRequestTarget.java:241)
         at org.apache.wicket.request.target.resource.ResourceStreamRequestTarget.respond(ResourceStreamRequestTarget.java:150)
         at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:105)
         at org.apache.wicket.RequestCycle.respond(RequestCycle.java:1267)
         at org.apache.wicket.RequestCycle.step(RequestCycle.java:1334)
         at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436)
         at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
         at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:484)
         at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:138)
...

On Thu, Oct 1, 2015 at 11:52 AM, Maciej Filocha <m.filocha@anonymised.com>
wrote:

Hi,

I'm using windbarbs with following definition:

<WellKnownName>windbarbs://default(<ogc:PropertyName>speed</ogc:PropertyName>)[m/s]</WellKnownName>

Everything works as expected except the "Preview legend" command that
throws an error:

ERROR [wicket.RequestCycle] - The specified mark
strConcat([strConcat([windbarbs://default(], [speed])], [)[m/s]]) was
not found!

Any ideas?

Simple, in the preview we have no values for the speed attribute, so no
mark can be generated (there, and in
GetLegendGraphics). We'd need some way to specify default values, but it's
not so easy...
something like "if_the_else(isNull(speed),10,speed)" should do the trick,
but as OGC expression it's a bit
long winded... I don't remember if we allow using ${...} expression in well
known mark, but you can give it a
try:

<WellKnownName>windbarbs://default(${if_the_else(isNull(speed),10,speed)})[m/s]</WellKnownName>

Cheers
Andrea

--

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 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

*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.

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

W dniu 01.10.2015 o 12:04, Andrea Aime pisze:

On Thu, Oct 1, 2015 at 11:52 AM, Maciej Filocha <m.filocha@anonymised.com
<mailto:m.filocha@anonymised.com>> wrote:

    Hi,

    I'm using windbarbs with following definition:

    <WellKnownName>windbarbs://default(<ogc:PropertyName>speed</ogc:PropertyName>)[m/s]</WellKnownName>

    Everything works as expected except the "Preview legend" command that
    throws an error:

    ERROR [wicket.RequestCycle] - The specified mark
    strConcat([strConcat([windbarbs://default(], [speed])], [)[m/s]]) was
    not found!

    Any ideas?

Simple, in the preview we have no values for the speed attribute, so no
mark can be generated (there, and in
GetLegendGraphics). We'd need some way to specify default values, but
it's not so easy...
something like "if_the_else(isNull(speed),10,speed)" should do the
trick, but as OGC expression it's a bit
long winded... I don't remember if we allow using ${...} expression in
well known mark, but you can give it a
try:

<WellKnownName>windbarbs://default(${if_the_else(isNull(speed),10,speed)})[m/s]</WellKnownName>

After changing "if_the_else" to "if_then_else", I got:

2015-10-01 10:17:06,196 ERROR [wicket.RequestCycle] - Filter Function problem for function strConcat argument #0 - expected type String
java.lang.IllegalArgumentException: Filter Function problem for function strConcat argument #0 - expected type String
         at org.geotools.filter.function.FilterFunction_strConcat.evaluate(FilterFunction_strConcat.java:52)
         at org.geotools.filter.expression.ExpressionAbstract.evaluate(ExpressionAbstract.java:65)

Anyway, I can live without legend preview...

Maciej