Re: [Geoserver-users] Problem with strSubstring function in SLD
On 14/11/12 02:33, cmaul wrote: > I am wondering whether it actually is an error. My assumption was that > is always a string. > > The method, strSubstring (string:String, begin:Integer, end:Integer) > clearly wants a string and two integers. So, you must give these types to > that method. this might be a reasonable argument - but if so, the geoserver documentaiton page should be updated, as it contains samples where number are provided as literals, and that is quite misleading (took me about 2 hours of in-code debugging to find out what the real problem is, and I already had the whole thing set up in eclipse for debugging beforehand) -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov ___ Geoserver-users mailing list Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users
Re: [Geoserver-users] Problem with strSubstring function in SLD
I am wondering whether it actually is an error. My assumption was that is always a string. The method, strSubstring (string:String, begin:Integer, end:Integer) clearly wants a string and two integers. So, you must give these types to that method. Hence, the correct form would be: STATIONNAME //String - param[0] //1. Int – param[1] 0 //2. Int – param[2] 3 That works for me and obviously for Ákos. If I wrap the first parseInt function into a Like below I get: STATIONNAME // 0 // 3 java.lang.IllegalArgumentException: Filter Function problem for function strSubstring argument #1 - expected type int at org.geotools.filter.function.FilterFunction_strSubstring.evaluate(FilterFunction_strSubstring.java:55). Fair enough, that is what I expect, because my integer is converted again into a string. Now when I put an AA instead of a number in there: STATIONNAME AA 3 Geoserver tries to think for me and puts a 0 in and displays the label. Well to assume that everything for the first parameter, which cannot be read or converted, is position 0, is fine. Now, trying to trick Geoserver, because it cannot make assumption about the end of the string gets the following result: STATIONNAME 0 BB This goes through the validation but at Submit I get the following error: 14 Nov 11:05:53 WARN [catalog.impl] - Catalog listener threw exception handling event. java.lang.NullPointerException at org.geoserver.gwc.layer.CatalogConfiguration.getLayerInfosFor(CatalogConfiguration.java:413) Nevertheless the style is submitted successfully, however, the map displays without label. My point is: I think this is actually enough, however, I would like to see an error message from parseInt or other functions, because if I write AA in an SLD, it is obvious, that this is no int. If the value comes from a database it is not. The implicit conversion would rather confuse me and there is no way to check beforehand if the string value to be converted is correct if it is a varialble. Furthermore, the implicit conversion from literal/String into the right Java type needs to be done either for all methods or for none. As these methods will increase. I am pretty sure the conversion will be forgotten for the odd method to be added in the future and that is bad. I think I would prefer an error message from parseInt instead of nothing and going through the documentation and change the wording that it becomes clear what type a function passes back and may be adding a few examples, so that people understand that types matter when using methods. - Dr Christian Maul Project Manager Information Services Branch Department of Sustainability and Environment Level13, Marland House, 570 Bourke Street Melbourne 3000 PO Box 500, East Melbourne Vic 3002 Telephone:+61-3-8636 2325 Telefax: +61-3-8636 2813 -- View this message in context: http://osgeo-org.1560.n6.nabble.com/Problem-with-strSubstring-function-in-SLD-tp5015967p5016135.html Sent from the GeoServer - User mailing list archive at Nabble.com. -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov ___ Geoserver-users mailing list Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users
Re: [Geoserver-users] Problem with strSubstring function in SLD
Ok, issue is generalized. Any functions known to require improvement can be added. This is simple stuff, for sure - but that might make it appealing for a developer who wants to make a contribution, but on something easy and low-risk. The hardest part will be creating unit tests.. 8^) On Tue, Nov 13, 2012 at 11:30 AM, Andrea Aime wrote: > On Tue, Nov 13, 2012 at 7:03 PM, Martin Davis wrote: > >> There's a ticket for this issue for just the IEERemainder function here: >> >> https://jira.codehaus.org/browse/GEOT-4267 >> >> Perhaps it could be generalized. >> > > Yep, same general problem. Please do. > > The issue with these tasks is that they are rather thankless development > wise, > I don't see anyone venturing into fixing that in their spare time > > Cheers > Andrea > > > -- > == > Our support, Your Success! Visit http://opensdi.geo-solutions.it 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 > > --- > > -- Martin Davis OpenGeo - http://opengeo.org Expert service straight from the developers. -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov___ Geoserver-users mailing list Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users
Re: [Geoserver-users] Problem with strSubstring function in SLD
On Tue, Nov 13, 2012 at 7:03 PM, Martin Davis wrote: > There's a ticket for this issue for just the IEERemainder function here: > > https://jira.codehaus.org/browse/GEOT-4267 > > Perhaps it could be generalized. > Yep, same general problem. Please do. The issue with these tasks is that they are rather thankless development wise, I don't see anyone venturing into fixing that in their spare time Cheers Andrea -- == Our support, Your Success! Visit http://opensdi.geo-solutions.it 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 --- -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov___ Geoserver-users mailing list Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users
Re: [Geoserver-users] Problem with strSubstring function in SLD
There's a ticket for this issue for just the IEERemainder function here: https://jira.codehaus.org/browse/GEOT-4267 Perhaps it could be generalized. On Tue, Nov 13, 2012 at 6:16 AM, Andrea Aime wrote: > On Tue, Nov 13, 2012 at 2:46 PM, Ákos Maróy wrote: > >> I found a similar issue, and my solution was to explicitly convert the >> literal numbers to ints, like this: >> >> >> 0 >> >> > > Checked and yeah, some filter functions including strSubstring are not > trying to do the > string -> int conversion for parameters (the xml parser does not know if > they are supposed > to be strings or numbers, just keeps strings) > > Hmm... fixing this will require some thanksless inspection in all the > filter functions, > and add the second param to expression.evaluate(...) to specify the > desired output type. > > https://github.com/geotools/geotools/tree/master/modules/library/main/src/main/java/org/geotools/filter/function > > Any taker? > Can someone open a ticket on jira.codehaus.org? > > Cheers > Andrea > > -- > == > Our support, Your Success! Visit http://opensdi.geo-solutions.it 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 > > --- > > > > -- > Monitor your physical, virtual and cloud infrastructure from a single > web console. Get in-depth insight into apps, servers, databases, vmware, > SAP, cloud infrastructure, etc. Download 30-day Free Trial. > Pricing starts from $795 for 25 servers or applications! > http://p.sf.net/sfu/zoho_dev2dev_nov > ___ > Geoserver-users mailing list > Geoserver-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/geoserver-users > > -- Martin Davis OpenGeo - http://opengeo.org Expert service straight from the developers. -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov___ Geoserver-users mailing list Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users
Re: [Geoserver-users] Problem with strSubstring function in SLD
El 13/11/2012 10:46, Ákos Maróy escribió: On 13/11/12 13:52, Orlando Irrazabal wrote: Hi, I am trying to cut a substring from my data for labeling polygons, i'm using the strSubstring function, but Geoserver doesn't render any label. According to documents (http://docs.geoserver.org/stable/en/user/filter/function_reference.html#string-functions), strSubstring syntax is: strSubstring(string, integer, integer) Here is a snippet of my sld: NOMENC_MZN 1 10 Geoserver's log shows: 2012-11-06 13:47:51,554 ERROR [renderer.label] - Error adding label to the label cache java.lang.IllegalArgumentException: Filter Function problem for function strSubstring argument #1 - expected type int I found a similar issue, and my solution was to explicitly convert the literal numbers to ints, like this: 0 Thanks Ákos, that's works Orlando -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov___ Geoserver-users mailing list Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users
Re: [Geoserver-users] Problem with strSubstring function in SLD
On Tue, Nov 13, 2012 at 2:46 PM, Ákos Maróy wrote: > I found a similar issue, and my solution was to explicitly convert the > literal numbers to ints, like this: > > > 0 > > Checked and yeah, some filter functions including strSubstring are not trying to do the string -> int conversion for parameters (the xml parser does not know if they are supposed to be strings or numbers, just keeps strings) Hmm... fixing this will require some thanksless inspection in all the filter functions, and add the second param to expression.evaluate(...) to specify the desired output type. https://github.com/geotools/geotools/tree/master/modules/library/main/src/main/java/org/geotools/filter/function Any taker? Can someone open a ticket on jira.codehaus.org? Cheers Andrea -- == Our support, Your Success! Visit http://opensdi.geo-solutions.it 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 --- -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov___ Geoserver-users mailing list Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users
Re: [Geoserver-users] Problem with strSubstring function in SLD
On 13/11/12 13:52, Orlando Irrazabal wrote: > Hi, > > I am trying to cut a substring from my data for labeling polygons, i'm using > the strSubstring function, > but Geoserver doesn't render any label. > > According to documents > (http://docs.geoserver.org/stable/en/user/filter/function_reference.html#string-functions), > > strSubstring syntax is: > strSubstring(string, integer, integer) > > > Here is a snippet of my sld: > > > NOMENC_MZN > 1 > 10 > > > > Geoserver's log shows: > > 2012-11-06 13:47:51,554 ERROR [renderer.label] - Error adding label to the > label cache > java.lang.IllegalArgumentException: Filter Function problem for function > strSubstring argument #1 - expected type int I found a similar issue, and my solution was to explicitly convert the literal numbers to ints, like this: 0 -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov___ Geoserver-users mailing list Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users
[Geoserver-users] Problem with strSubstring function in SLD
Hi, I am trying to cut a substring from my data for labeling polygons, i'm using the strSubstring function, but Geoserver doesn't render any label. According to documents (http://docs.geoserver.org/stable/en/user/filter/function_reference.html#string-functions), strSubstring syntax is: strSubstring(string, integer, integer) Here is a snippet of my sld: NOMENC_MZN 1 10 Geoserver's log shows: 2012-11-06 13:47:51,554 ERROR [renderer.label] - Error adding label to the label cache java.lang.IllegalArgumentException: Filter Function problem for function strSubstring argument #1 - expected type int at org.geotools.filter.function.FilterFunction_strSubstring.evaluate(FilterFunction_strSubstring.java:64) at org.geotools.filter._expression_.ExpressionAbstract.evaluate(ExpressionAbstract.java:65) at org.geotools.renderer.label.LabelCacheImpl.put(LabelCacheImpl.java:269) at org.geotools.renderer.lite.StreamingRenderer.processSymbolizers(StreamingRenderer.java:2750) at org.geotools.renderer.lite.StreamingRenderer.process(StreamingRenderer.java:2656) at org.geotools.renderer.lite.StreamingRenderer.drawPlain(StreamingRenderer.java:2512) at org.geotools.renderer.lite.StreamingRenderer.processStylers(StreamingRenderer.java:2013) at org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:814) at org.geoserver.wms.map.RenderedImageMapOutputFormat.produceMap(RenderedImageMapOutputFormat.java:490) at org.geoserver.wms.map.RenderedImageMapOutputFormat.produceMap(RenderedImageMapOutputFormat.java:254) at org.geoserver.wms.map.RenderedImageMapOutputFormat.produceMap(RenderedImageMapOutputFormat.java:126) at org.geoserver.wms.GetMap.executeInternal(GetMap.java:472) at org.geoserver.wms.GetMap.run(GetMap.java:208) at org.geoserver.wms.GetMap.run(GetMap.java:112) at org.geoserver.wms.DefaultWebMapService.getMap(DefaultWebMapService.java:353) at sun.reflect.GeneratedMethodAccessor367.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.geoserver.gwc.wms.CacheSeedingWebMapService.invoke(CacheSeedingWebMapService.java:61) at org.geoserver.gwc.wms.CacheSeedingWebMapService.invoke(CacheSeedingWebMapService.java:35) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.geoserver.gwc.wms.CachingWebMapService.invoke(CachingWebMapService.java:69) at org.geoserver.gwc.wms.CachingWebMapService.invoke(CachingWebMapService.java:50) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.geoserver.ows.util.RequestObjectLogger.invoke(RequestObjectLogger.java:54) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at $Proxy28.getMap(Unknown Source) at sun.reflect.GeneratedMethodAccessor333.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.geoserver.ows.Dispatcher.execute(Dispatcher.java:772) at org.geoserver.ows.Dispatcher.handleRequestInternal(Dispatcher.java:272) at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153) at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)