Discussion:
[Geoserver-users] How filters(in YAML or SLD files style) are proccessed by Geoserver?
D***@telekom.de
2017-04-25 15:28:43 UTC
Permalink
Hi geoserver-community,

My name is David, this is my first post in the list and I feel curious about how SLD styling works in Geoserver. I am styling some layers using YSLD files and I am using filters in my rules. These filters look like this:

name: style_example
title: projects
feature-styles:
- rules:
- filter: ${ Attribute1 = 'Value A' AND status = 'Ok'}
name: Ok
symbolizers:
- point:
size: *size
symbols:
- mark:
shape: circle
fill-color: '#0000FF'

I have lots of similar rules and the statement Attribute1 = 'Value A' never changes.
I have used the following way for working with variables:

define: &attribute_name ${Attribute1 = 'Value A'}
name: style_example2
title: projects
feature-styles:
- rules:
- filter: *attribute_name
- filter: ${status = 'Ok'}
name: Ok
symbolizers:
- point:
size: *size
symbols:
- mark:
shape: circle
fill-color: '#0000FF'

Would you know if Geoserver process these two types of styling in the same way? I mean, needs Geoserver to import the data twice when I use two filters in my rule instead of compounding the statements in only one filter?

The next thing may it be related or not but, I have tried to compare the SLD version using the Rest API(Geoserver version 2.10.2), and I couldn't be able to get the SLD version of my style:
http://localhost:8080/geoserver/rest/resource/workspaces/myworkspace/styles/yaml_file_example.sld
Even though I am able to download the yaml version(native extension of the style) using the Rest API, I can not get the SLD (transformed) version of the style. I have the following answer from Geoserver:
Undefined resource path.
(However, I am able to get the SLD and YAML version of the example styles of Geoserver)

Thank a lot,
David


---
Deutsche Telekom IT GmbH
Technology Solution
David Lopez Villegas
GIS-mobile
Oberkasseler Strasse 2, 53227 Bonn, Germany
+49 228 18149623 (Phone)

E-Mail: david-***@telekom.de<mailto:david-***@telekom.de>
Internet: www.telekom.com<http://www.telekom.com>

Life is for sharing.

You can find the obligatory information on www.telekom.com/compulsory-statement-dtit<http://www.telekom.com/compulsory-statement-dtit>
Big changes start small - conserve resources by not printing every e-mail.

Notice: This transmittal and/or attachments may be privileged or confidential. It is intended solely for the addressee named above. Any dissemination, or copying is strictly prohibited. If you received this transmittal in error, please notify us immediately by reply and immediately delete this message and all its attachments. Thank you.
Andrea Aime
2017-04-25 17:11:43 UTC
Permalink
Hi,
the rules here are a bit complex. In general GeoServer tries to make a
single query per layer to the data source by combining in OR the various
filters.
However, some data sources report errors or have very poor performance with
large/complex filters, so there is a hard-coded limit
of 20 combined filters to be sent to the database, if we go above, only the
BBOX filter is sent and all other filtering happens in memory.

This limit rarely needs tweaking so it's not exposed in the UI or
configuration, but if you need to change it, you can set a system
variable, servlet variable, or environment variable to alter it. It's
called MAX_FILTER_RULES.

For example, a system variable given to the JVM running GeoServer would
look like this:

-DMAX_FILTER_RULES=50

Cheers
Andrea
Post by D***@telekom.de
Hi geoserver-community,
My name is David, this is my first post in the list and I feel curious
about how SLD styling works in Geoserver. I am styling some layers using
name: style_example
title: projects
- filter: ${ Attribute1 = 'Value A' AND status = 'Ok'}
name: Ok
size: *size
shape: circle
fill-color: '#0000FF'
I have lots of similar rules and the statement Attribute1 = ‘Value A’
never changes.
define: &attribute_name ${Attribute1 = 'Value A'}
name: style_example2
title: projects
- filter: *attribute_name
- filter: ${status = 'Ok'}
name: Ok
size: *size
shape: circle
fill-color: '#0000FF'
Would you know if Geoserver process these two types of styling in the same
way? I mean, needs Geoserver to import the data twice when I use two
filters in my rule instead of compounding the statements in only one filter?
The next thing may it be related or not but, I have tried to compare the
SLD version using the Rest API(Geoserver version 2.10.2), and I couldn’t be
*http://localhost:8080/geoserver/**rest/**resource/workspaces/*
*myworkspace**/styles**/yaml_**file_example**.**sld*
<http://localhost:8080/geoserver/rest/resource/workspaces/myworkspace/styles/yaml_file_example.sld>
Even though I am able to download the yaml version(native extension of the
style) using the Rest API, I can not get the SLD (transformed) version of
Undefined resource path.
(However, I am able to get the SLD and YAML version of the example styles of Geoserver)
Thank a lot,
David
*---*
*Deutsche Telekom IT GmbH*
Technology Solution
David Lopez Villegas
GIS-mobile
Oberkasseler Strasse 2, 53227 Bonn, Germany
+49 228 18149623 <+49%20228%2018149623> (Phone)
Internet: *www.telekom.com* <http://www.telekom.com>
*Life is for sharing.*
You can find the obligatory information on
*www.telekom.com/compulsory-statement-dtit*
<http://www.telekom.com/compulsory-statement-dtit>
*Big changes start small – conserve resources by not printing every
e-mail.*
Notice: This transmittal and/or attachments may be privileged or
confidential. It is intended solely for the addressee named above. Any
dissemination, or copying is strictly prohibited. If you received this
transmittal in error, please notify us immediately by reply and immediately
delete this message and all its attachments. Thank you.
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Geoserver-users mailing list
https://lists.sourceforge.net/lists/listinfo/geoserver-users
--
==
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

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

-------------------------------------------------------
D***@telekom.de
2017-04-28 14:48:59 UTC
Permalink
Hi Andrea,

Your explanation has been concise and actually clear, I understand better now how Geoserver works with styles, thank you so much.

Best regards,
David

---
Deutsche Telekom IT GmbH
Technology Solution
David Lopez Villegas
GIS-mobile
Oberkasseler Strasse 2, 53227 Bonn, Germany
+49 228 18149623 (Phone)

E-Mail: david-***@telekom.de<mailto:david-***@telekom.de>
Internet: www.telekom.com<http://www.telekom.com>

Life is for sharing.

You can find the obligatory information on www.telekom.com/compulsory-statement-dtit<http://www.telekom.com/compulsory-statement-dtit>
Big changes start small - conserve resources by not printing every e-mail.

Notice: This transmittal and/or attachments may be privileged or confidential. It is intended solely for the addressee named above. Any dissemination, or copying is strictly prohibited. If you received this transmittal in error, please notify us immediately by reply and immediately delete this message and all its attachments. Thank you.
Loading...