Thanks Andrea, that explains it.
I have discovered that if you break the rules up across feature type styles,
the order defined in the SLD is maintained in the drawing order. This works for
my purposes, but I’m wondering if there are any drawbacks.
For instance, we are also using the sld:Priority tag to determine labelling
priority. Does this work across feature types? What I want is one rule to have
higher labelling priority than another using a second field to determine the
labelling priority in that rule. For example, in bold below:
<sld:Rule>
<sld:Name>historic_mines</sld:Name>
<sld:Title>Historic Mine</sld:Title>
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>OPERATING_STATUS</ogc:PropertyName>
<ogc:Literal>historic mine</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<sld:PointSymbolizer>
<sld:Graphic>
<sld:ExternalGraphic>
<sld:OnlineResource
xlink:type="simple"
xlink:href="icons/historic.svg"/>
<sld:Format>image/svg+xml</sld:Format>
</sld:ExternalGraphic>
</sld:Graphic>
</sld:PointSymbolizer>
<sld:TextSymbolizer>
<sld:Label>
<ogc:PropertyName>NAME</ogc:PropertyName>
</sld:Label>
<sld:Font>
<sld:CssParameter name="font-family">Arial</sld:CssParameter>
<sld:CssParameter name="font-size">12</sld:CssParameter>
<sld:CssParameter name="font-style">normal</sld:CssParameter>
<sld:CssParameter name="font-weight">normal</sld:CssParameter>
</sld:Font>
<sld:LabelPlacement>
<sld:PointPlacement>
<sld:AnchorPoint>
<sld:AnchorPointX>0.0</sld:AnchorPointX>
<sld:AnchorPointY>0.5</sld:AnchorPointY>
</sld:AnchorPoint>
<sld:Displacement>
<sld:DisplacementX>10</sld:DisplacementX>
<sld:DisplacementY>0.3</sld:DisplacementY>
</sld:Displacement>
</sld:PointPlacement>
</sld:LabelPlacement>
<sld:Halo>
<sld:Radius>2</sld:Radius>
<sld:Fill>
<sld:CssParameter name="fill">#ffffff</sld:CssParameter>
</sld:Fill>
</sld:Halo>
<sld:Fill>
<sld:CssParameter name="fill">#000000</sld:CssParameter>
</sld:Fill>
<sld:Priority>
<ogc:Function>
<ogc:Sub>
<ogc:Literal>20</ogc:Literal>
<ogc:PropertyName>SIGNIFICANCE</ogc:PropertyName>
</ogc:Sub>
</ogc:Function>
</sld:Priority>
<sld:VendorOption name="partials">true</sld:VendorOption>
<sld:VendorOption name="spaceAround">10</sld:VendorOption>
</sld:TextSymbolizer>
</sld:Rule>
Will that priority be applied to all Rules across all FeatureTypeStyles?
From: Andrea Aime <[email protected]>
Sent: Tuesday, 1 June 2021 5:34 PM
To: Sexton Michael <[email protected]>
Cc: [email protected]
Subject: Re: [Geoserver-users] Sorting SLD symbology using the recode function
[SEC=UNOFFICIAL]
Hi,
I'm afraid it's not possible to use any type of expression in a vendor option.
At the Java API level, vendor options values are just static strings, they
cannot contain
dynamic behavior. It's technically feasible to switch from String to Expression
(which would
allow function usage), but also a large change. It would be a pretty good
improvement though!
Going back to sorting, with the current capabilities, you can only provide a
field name. So,
a way to achieve what you want, if your data source is a database, is to create
a view,
either in the database or as a GeoServer SQL view, that computes the sorting
score as a new attribute.
Then you use the sortBy against this new attribute. That should do it.
Cheers
Andrea
On Tue, Jun 1, 2021 at 8:33 AM Sexton Michael
<[email protected]<mailto:[email protected]>> wrote:
Hi Geoserver User list
I have a layer where I want certain rules to be rendered higher in the z-order,
using the vendor option ‘sortBy’, as described
here<https://docs.geoserver.org/latest/en/user/styling/sld/extensions/z-order/index.html>.
However the field I wish to sort on is text, not numeric.
I thought I could do this using the Recode function, as follows:
<sld:VendorOption name="sortBy">
<ogc:Function name="Recode">
<ogc:PropertyName>OPERATING_STATUS</ogc:PropertyName>
<ogc:Literal>mineral deposit</ogc:Literal>
<ogc:Literal>50</ogc:Literal>
<ogc:Literal>historic mine</ogc:Literal>
<ogc:Literal>60</ogc:Literal>
<ogc:Literal>closed</ogc:Literal>
<ogc:Literal>70</ogc:Literal>
<ogc:Literal>under development</ogc:Literal>
<ogc:Literal>80</ogc:Literal>
<ogc:Literal>feasibility</ogc:Literal>
<ogc:Literal>80</ogc:Literal>
<ogc:Literal>care and maintenance</ogc:Literal>
<ogc:Literal>90</ogc:Literal>
<ogc:Literal>operating mine</ogc:Literal>
<ogc:Literal>100</ogc:Literal>
</ogc:Function>
</sld:VendorOption>
But this seems to do nothing. Is there a way to sort a text field according to
a preset numerical ordering?
Thanks
Michael
Geoscience Australia Disclaimer: This e-mail (and files transmitted with it) is
intended only for the person or entity to which it is addressed. If you are not
the intended recipient, then you have received this e-mail by mistake and any
use, dissemination, forwarding, printing or copying of this e-mail and its file
attachments is prohibited. The security of emails transmitted cannot be
guaranteed; by forwarding or replying to this email, you acknowledge and accept
these risks.
_______________________________________________
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
[email protected]<mailto:[email protected]>
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.
Geoscience Australia Disclaimer: This e-mail (and files transmitted with it) is
intended only for the person or entity to which it is addressed. If you are not
the intended recipient, then you have received this e-mail by mistake and any
use, dissemination, forwarding, printing or copying of this e-mail and its file
attachments is prohibited. The security of emails transmitted cannot be
guaranteed; by forwarding or replying to this email, you acknowledge and accept
these risks.
_______________________________________________
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users