Andrea,
I am not sure if anyone is interested in this but I have managed to make this work. However, I cannot get the OGC version of the filter to work at all when you multiply a denominator by a constant. See previous emails below… So I switched my efforts to using a CQL_Filter. median_tot_fam_inc_weekly > 0.0 AND median_mortgage_repay_monthly > 0.0 AND ((median_mortgage_repay_monthly / (median_tot_fam_inc_weekly * 4.3333333)) * 100) >=30 AND ((median_mortgage_repay_monthly / (median_tot_fam_inc_weekly * 4.3333333)) * 100) <= 80 This also failed when you multiply a denominator with a constant. I know this because I changed the formula to not have a multiplier on a denominator in the equation and it finally worked. median_tot_fam_inc_weekly > 0.0 AND median_mortgage_repay_monthly > 0.0 AND ((median_mortgage_repay_monthly / median_tot_fam_inc_weekly) * 23.076923) >= 30 AND ((median_mortgage_repay_monthly / median_tot_fam_inc_weekly) * 23.076923) <= 80 I may go back and try this solution with the OGC version. Cheers, Brad Spencer Managing Director http://www.numaps.com.au/ mob: 0404 841 131 BradArt <https://www.facebook.com/pg/numaps.com.au/photos/?ref=page_internal> From: Brad Spencer <b...@numaps.com.au> Sent: 06 April 2020 11:08 To: 'andrea.a...@geo-solutions.it' <andrea.a...@geo-solutions.it> Cc: 'Brad Hards' <br...@frogmouth.net>; 'GeoServer Mailing List List' <geoserver-users@lists.sourceforge.net> Subject: RE: [Geoserver-users] SLD on Geoserver Andrea, I am back on this again. I tried your isBetween option and I am still getting a geoserver rendering problems. Part of stack trace = ‘Rendering process failed java.io.IOExceptionUnable to evaulate class org.geotools.feature.type.AttributeDescriptorImpl in a numeric context Details:’ I even changed the formula around to see if the multiplication of a denominator could be the problem to yield a weekly percentage instead which also failed. <ogc:Filter> <ogc:And> <ogc:PropertyIsGreaterThan> <ogc:PropertyName>median_mortgage_repay_monthly</ogc:PropertyName> <ogc:Literal>0.0</ogc:Literal> </ogc:PropertyIsGreaterThan> <ogc:PropertyIsBetween> <ogc:Div> <ogc:Div> <ogc:PropertyName>median_mortgage_repay_monthly</ogc:PropertyName> <ogc:Literal>4.333333</ogc:Literal> </ogc:Div> <ogc:PropertyName>median_tot_prsnl_inc_weekly</ogc:PropertyName> </ogc:Div> <ogc:LowerBoundary> <ogc:Literal>0.45</ogc:Literal> </ogc:LowerBoundary> <ogc:UpperBoundary> <ogc:Literal>0.65</ogc:Literal> </ogc:UpperBoundary> </ogc:PropertyIsBetween> </ogc:And> </ogc:Filter> So given I just cannot get this to work and given that this is a simple two part filter (range) requiring only one colour classification I have decided to shift my tack on to a CQL filter. Hopefully that will work. Cheers, Brad Spencer Managing Director http://www.numaps.com.au/ mob: 0404 841 131 BradArt <https://www.facebook.com/pg/numaps.com.au/photos/?ref=page_internal> From: Andrea Aime <andrea.a...@geo-solutions.it <mailto:andrea.a...@geo-solutions.it> > Sent: 29 March 2020 03:45 To: Brad Spencer <b...@numaps.com.au <mailto:b...@numaps.com.au> > Cc: Brad Hards <br...@frogmouth.net <mailto:br...@frogmouth.net> >; GeoServer Mailing List List <geoserver-users@lists.sourceforge.net <mailto:geoserver-users@lists.sourceforge.net> > Subject: Re: [Geoserver-users] SLD on Geoserver Hi Brad, I don't have your dataset, so could not use a 1-1 reproduction, but adapted your original style, plus my suggestion, to the topp:states sample dataset (included in the default installation of GeoServer), calculating a percentage of employed people, and painting red only the states having between 45% and 65% employed. The style is: <?xml version="1.0" encoding="UTF-8"?> <StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"> <NamedLayer> <Name>undefined</Name> <UserStyle> <Title>braddles tester7</Title> <FeatureTypeStyle> <Rule> <Name>Employed between 45% and 65%</Name> <ogc:Filter> <ogc:And> <ogc:PropertyIsGreaterThan> <ogc:PropertyName>PERSONS</ogc:PropertyName> <ogc:Literal>0.0</ogc:Literal> </ogc:PropertyIsGreaterThan> <ogc:PropertyIsBetween> <ogc:Div> <ogc:PropertyName>EMPLOYED</ogc:PropertyName> <ogc:PropertyName>PERSONS</ogc:PropertyName> </ogc:Div> <ogc:LowerBoundary> <ogc:Literal>0.45</ogc:Literal> </ogc:LowerBoundary> <ogc:UpperBoundary> <ogc:Literal>0.65</ogc:Literal> </ogc:UpperBoundary> </ogc:PropertyIsBetween> </ogc:And> </ogc:Filter> <PolygonSymbolizer> <Fill> <CssParameter name="fill">#FF0000</CssParameter> </Fill> <Stroke> <CssParameter name="stroke">#000000</CssParameter> </Stroke> </PolygonSymbolizer> </Rule> </FeatureTypeStyle> </UserStyle> </NamedLayer> </StyledLayerDescriptor> and the resulting map is: Appears to be working here. I cannot imagine why something similar would not work in another dataset... maybe if you can share a sample of the data, some of us here can load it up and give it a spin Cheers Andrea On Sat, Mar 28, 2020 at 2:01 PM Brad Spencer <b...@numaps.com.au <mailto:b...@numaps.com.au> > wrote: Brad, I can’t see anything wrong with the data. I can inspect polygons that should be rendered but which are not. I am wondering is there is any other way in Geoserver to show percentage ranges? Cheers, Brad…. From: Brad Hards <br...@frogmouth.net <mailto:br...@frogmouth.net> > Sent: 28 March 2020 09:24 To: 'Brad Spencer' <b...@numaps.com.au <mailto:b...@numaps.com.au> >; geoserver-users@lists.sourceforge.net <mailto:geoserver-users@lists.sourceforge.net> Subject: RE: [Geoserver-users] SLD on Geoserver I think its more likely that there is something in the source data that isn’t being accounted for. I’d look there next. What are the mean, range, stddev of the data in the database? Are there nulls? Brad From: Brad Spencer <b...@numaps.com.au <mailto:b...@numaps.com.au> > Sent: Saturday, 28 March 2020 8:11 AM To: 'Brad Hards' <br...@frogmouth.net <mailto:br...@frogmouth.net> >; geoserver-users@lists.sourceforge.net <mailto:geoserver-users@lists.sourceforge.net> Subject: RE: [Geoserver-users] SLD on Geoserver Brad, When I try to find the polygons below 30% as you suggested I do not get the reverse of polygons above 30%. This is really weird as it would appear to me that the <PropertyIsLessThanOrEqualTo> and for that matter the <PropertyIsLessThan> are not working correctly at least not on my version of Geoserver, or the Ands are not configured correctly. I get the same results testing via the geoserver app where I loaded a style with the same sld. Cheers, Brad… From: Brad Hards <br...@frogmouth.net <mailto:br...@frogmouth.net> > Sent: 27 March 2020 09:13 To: 'Brad Spencer' <b...@numaps.com.au <mailto:b...@numaps.com.au> >; geoserver-users@lists.sourceforge.net <mailto:geoserver-users@lists.sourceforge.net> Subject: RE: [Geoserver-users] SLD on Geoserver It sounds (to me) like your SLD is not matching your data – we can’t see the data of course, but if you change your analysis to be all polygons below 30% (just keep the first check, and use PropertyIsLessThanOrEqualTo), does it look right? Do you get anything? Brad _______________________________________________ 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 Geoserver-users@lists.sourceforge.net <mailto:Geoserver-users@lists.sourceforge.net> 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 Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users