[Geoserver-users] How to group values in SLD

Hello.

First of all, excuse my poor English.

I have the following problem. I need to represent a lot of polygons (hundreds) in GeoServer with SLD_BODY option. The request is very long, so it is a problem in the client environment, because the request is cut and it doesn’t execute. I need to make it smaller.

I have hundred of polygons, but all polygons are painted with a color from five available, so instead of define a rule for each polygon, I would like to group all the polygons with the same symbol to reduce the length of the request. Is it possible to use something similar to “IN” operator to group values to represent?

How can I obtain somethin similar to:

ID **1,2,3,4,7,34,65,98,322,…**

Thanks in advance

Best regards

Un saludo











Jefe de Grupo de Actuaciones y Proyectos



Gerencia de SIG y Consultoría



Grupo Tragsa (Grupo SEPI)











Julián Camarillo, 6B · Planta 2ªB



28037 Madrid



Tel.: +34 91 322 64 89



Fax: +34 91 322 64 48



pbg@anonymised.com



www.tragsa.es





En beneficio del medio ambiente, imprime este e-mail sólo si realmente es necesario.


El consumo de papel es perjudicial para el medio ambiente. Por favor, tengalo en cuenta antes de imprimir este mensaje.

AVISO LEGAL: Este mensaje y sus anexos pueden contener informacion confidencial o legalmente protegida. Esta dirigido unicamente a la persona o entidad indicada como destinatarios del mensaje. Si este mensaje le hubiera llegado por error, por favor eliminelo sin revisarlo ni reenviarlo y notifiquelo inmediatamente al remitente.


Pedro,

We used the function “in3” as referenced at http://docs.geoserver.org/latest/en/user/filter/function_reference.html This supports in2 through in10. You may be able to match multiple features based on the ogc:or.

Here is an example of how we used it:

sld:Rule

sld:NameDefault Rule 1 to inf</sld:Name>

ogc:Filter

ogc:PropertyIsEqualTo

<ogc:Function name=“in3”>

<ogc:Function name=“geometryType”>

ogc:PropertyNamethe_geom</ogc:PropertyName>

</ogc:Function>

ogc:LiteralLineString</ogc:Literal>

ogc:LiteralLinearRing</ogc:Literal>

ogc:LiteralMultiLineString</ogc:Literal>

</ogc:Function>

ogc:Literaltrue</ogc:Literal>

</ogc:PropertyIsEqualTo>

</ogc:Filter>

sld:LineSymbolizer

sld:Stroke

<sld:CssParameter name=“stroke-width”>.75</sld:CssParameter>

<sld:CssParameter name=“stroke”>#424242</sld:CssParameter>

</sld:Stroke>

</sld:LineSymbolizer>

</sld:Rule>

Your example

sld:Rule

sld:NameMatch MultipleFeatures</sld:Name>

ogc:Filter

ogc:Or

ogc:PropertyIsEqualTo

<ogc:Function name=“in3”>

ID

ogc:Literal1</ogc:Literal>

ogc:Literal2</ogc:Literal>

ogc:Literal3</ogc:Literal>

</ogc:Function>

ogc:Literaltrue</ogc:Literal>

</ogc:PropertyIsEqualTo>

ogc:PropertyIsEqualTo

<ogc:Function name=“in4”>

ID

ogc:Literal4</ogc:Literal>

ogc:Literal7</ogc:Literal>

ogc:Literal34</ogc:Literal>

ogc:Literal56</ogc:Literal>

</ogc:Function>

ogc:Literaltrue</ogc:Literal>

</ogc:PropertyIsEqualTo>

ogc:PropertyIsEqualTo

<ogc:Function name=“in2”>

ID

ogc:Literal98</ogc:Literal>

ogc:Literal322</ogc:Literal>

</ogc:Function>

ogc:Literaltrue</ogc:Literal>

</ogc:PropertyIsEqualTo>

</ogc:Or>

</ogc:Filter>

</sld:Rule>

image001.png

···

Chris Snider

Senior Software Engineer

Intelligent Software Solutions, Inc.

Description: Description: Description: cid:image001.png@anonymised.com633...

From: Pedro Briones Garcia [mailto:pbg@anonymised.com]
Sent: Tuesday, June 11, 2013 2:20 AM
To: ‘geoserver-users@lists.sourceforge.net’
Subject: [Geoserver-users] How to group values in SLD

Hello.

First of all, excuse my poor English.

I have the following problem. I need to represent a lot of polygons (hundreds) in GeoServer with SLD_BODY option. The request is very long, so it is a problem in the client environment, because the request is cut and it doesn’t execute. I need to make it smaller.

I have hundred of polygons, but all polygons are painted with a color from five available, so instead of define a rule for each polygon, I would like to group all the polygons with the same symbol to reduce the length of the request. Is it possible to use something similar to “IN” operator to group values to represent?

How can I obtain somethin similar to:

ID **1,2,3,4,7,34,65,98,322,…**

Thanks in advance

Best regards

Un saludo







Jefe de Grupo de Actuaciones y Proyectos



Gerencia de SIG y Consultoría



Grupo Tragsa (Grupo SEPI)











Julián Camarillo, 6B · Planta 2ªB



28037 Madrid



Tel.: +34 91 322 64 89



Fax: +34 91 322 64 48



pbg@anonymised.com…3477…



www.tragsa.es





En beneficio del medio ambiente, imprime este e-mail sólo si realmente es necesario.


El consumo de papel es perjudicial para el medio ambiente. Por favor, tengalo en cuenta antes de imprimir este mensaje.

AVISO LEGAL: Este mensaje y sus anexos pueden contener informacion confidencial o legalmente protegida. Esta dirigido unicamente a la persona o entidad indicada como destinatarios del mensaje. Si este mensaje le hubiera llegado por error, por favor eliminelo sin revisarlo ni reenviarlo y notifiquelo inmediatamente al remitente.


If using the “inX” functions is still too verbose, or if it’s awkward to split up the blocks of IDs, and depending on how much effort you want to spend…

You could look at writing a custom filter function “inList(int, String)”, where the second argument is a string literal which represents the list of IDs in some way (e.g. such as “1,2,3,4”).

···

On Tue, Jun 11, 2013 at 8:41 AM, Chris Snider <chris.snider@anonymised.com> wrote:

Pedro,

We used the function “in3” as referenced at http://docs.geoserver.org/latest/en/user/filter/function_reference.html This supports in2 through in10. You may be able to match multiple features based on the ogc:or.

On Tue, Jun 11, 2013 at 6:22 PM, Martin Davis <mtnclimb@anonymised.com> wrote:

If using the "inX" functions is still too verbose, or if it's awkward to
split up the blocks of IDs, and depending on how much effort you want to
spend...

You could look at writing a custom filter function "inList(int,
String)", where the second argument is a string literal which represents
the list of IDs in some way (e.g. such as "1,2,3,4").

One thing to notice though, the original filters are long but are going to
get encoded into SQL,
whist filter function are not unless someone changes the code in the SQL
encoders to recognize them,
or patches the SimplifyingFilterVisitor to expand the filter function into
a regular list of filters.

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

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