[Geoserver-users] specify a filter for each layer in a GetFeatureInfo request

Hi list,

according to the documentation at http://docs.geoserver.org/stable/en/user/services/wms/vendor.html#filter : “If more than one layer is specified in the layers parameter then a separate filter can be specified for each layer.”

But it does not say how I can do this, on cql_filter, each filter can be seperated by ‘;’ but it does not work like that for the filter. It further says that the filter can contain a list of several filters, enclosed in parentheses, but it seemingly has nothing to do with one filter for each layer.

I’ve been trying several forms (yes the final requests are url-encoded):
filter=(filterForFirstLayer;filterForSecondLayer)
filter=(filterForFirstLayer);(filterForSecondLayer)
filter=filterForFirstLayer;filterForSecondLayer

I’m sure the solution is easy but I can’t seem to find it.

Thanks,
Aleksander Vines

Aleksander,
I’ve never used them anyhow have you tried with commas?
filter=(FILTER),(FILTER),…

Let me know, we can take a look at the code if needed.
Cheers,
Carlo

···

2014-03-28 12:34 GMT+01:00 Aleksander Vines <aleksander.vines@anonymised.com>:

Hi list,

according to the documentation at http://docs.geoserver.org/stable/en/user/services/wms/vendor.html#filter : “If more than one layer is specified in the layers parameter then a separate filter can be specified for each layer.”

But it does not say how I can do this, on cql_filter, each filter can be seperated by ‘;’ but it does not work like that for the filter. It further says that the filter can contain a list of several filters, enclosed in parentheses, but it seemingly has nothing to do with one filter for each layer.

I’ve been trying several forms (yes the final requests are url-encoded):
filter=(filterForFirstLayer;filterForSecondLayer)
filter=(filterForFirstLayer);(filterForSecondLayer)
filter=filterForFirstLayer;filterForSecondLayer

I’m sure the solution is easy but I can’t seem to find it.

Thanks,
Aleksander Vines



Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

==
Meet us at GEO Business 2014! in London! Visit http://goo.gl/fES3aK for more information.

Dott. Carlo Cancellieri
@cancellieric
Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


I use the CQL_FILTER= with multiple layers.

For Example, layers=BASE:Countries,BASE:States_Provinces&styles=&CQL_FILTER=INCLUDE;Name=’SomeProvinceName’

If you don’t want to restrict a layer result set, use the INCLUDE filter. Or the EXCLUDE if you want to remove it completely.

The filters themselves can be built up to more complexity

CQL_FILTER=(MyAttribute=’Value1’ and MyOtherValue=’Value2’) or MyThirdAttribute=’Value3’

Chris Snider

Senior Software Engineer

Intelligent Software Solutions, Inc.

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

···

Aleksander,

I’ve never used them anyhow have you tried with commas?

filter=(FILTER),(FILTER),…

Let me know, we can take a look at the code if needed.

Cheers,

Carlo

2014-03-28 12:34 GMT+01:00 Aleksander Vines <aleksander.vines@anonymised.com>:

Hi list,

according to the documentation at http://docs.geoserver.org/stable/en/user/services/wms/vendor.html#filter : “If more than one layer is specified in the layers parameter then a separate filter can be specified for each layer.”

But it does not say how I can do this, on cql_filter, each filter can be seperated by ‘;’ but it does not work like that for the filter. It further says that the filter can contain a list of several filters, enclosed in parentheses, but it seemingly has nothing to do with one filter for each layer.

I’ve been trying several forms (yes the final requests are url-encoded):

filter=(filterForFirstLayer;filterForSecondLayer)

filter=(filterForFirstLayer);(filterForSecondLayer)

filter=filterForFirstLayer;filterForSecondLayer

I’m sure the solution is easy but I can’t seem to find it.

Thanks,

Aleksander Vines



Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

==

Meet us at GEO Business 2014! in London! Visit http://goo.gl/fES3aK for more information.

==

Dott. Carlo Cancellieri
@cancellieric
Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


Thanks for the replies,

Carlo: comma did not work either :frowning:
http://localhost:8090/geoserver/greensad/wms?LAYERS=layer1,layer2&QUERY_LAYERS=layer1,layer2&STYLES=,&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&BBOX=-138.689604,-68.094802,163.689604,83.094802&FEATURE_COUNT=2000&HEIGHT=400&WIDTH=800&FORMAT=image/png&INFO_FORMAT=text/html&SRS=EPSG:4326&X=368&Y=46&FILTER=(<ogc:Filter xmlns:ogc=“http://www.opengis.net/ogc”> … </ogc:Filter>),(<ogc:Filter xmlns:ogc=“http://www.opengis.net/ogc”> … </ogc:Filter>) → “org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1174; Content is not allowed in trailing section. Content is not allowed in trailing section.”

Chris: I was unclear when I mentioned CQL_FILTER, I’m using an OGC-XML-filter (as you see from above). I was just saying that what the documentation said about CQL_FILTERS did not work for the FILTER variable (using semicolon to separate the filters).

Still can’t seem to figure out this, and I’ve started to take a look at the source code myself to try to locate it, but I’m not very familiar with the Geoserver code :slight_smile:

Many thanks,
Aleksander Vines

Chris Snider chris.snider@anonymised.com , 3/28/2014 3:26 PM:

I use the CQL_FILTER= with multiple layers.

For Example, layers=BASE:Countries,BASE:States_Provinces&styles=&CQL_FILTER=INCLUDE;Name=’SomeProvinceName’

If you don’t want to restrict a layer result set, use the INCLUDE filter. Or the EXCLUDE if you want to remove it completely.

The filters themselves can be built up to more complexity

CQL_FILTER=(MyAttribute=’Value1’ and MyOtherValue=’Value2’) or MyThirdAttribute=’Value3’

Chris Snider

Senior Software Engineer

Intelligent Software Solutions, Inc.

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

From: carlo cancellieri [mailto:carlo.cancellieri@anonymised.com]
Sent: Friday, March 28, 2014 6:31 AM
To: Aleksander Vines
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] specify a filter for each layer in a GetFeatureInfo request

Aleksander,

I’ve never used them anyhow have you tried with commas?

filter=(FILTER),(FILTER),…

Let me know, we can take a look at the code if needed.

Cheers,

Carlo

2014-03-28 12:34 GMT+01:00 Aleksander Vines <aleksander.vines@anonymised.com>:

Hi list,

according to the documentation at http://docs.geoserver.org/stable/en/user/services/wms/vendor.html#filter : “If more than one layer is specified in the layers parameter then a separate filter can be specified for each layer.”

But it does not say how I can do this, on cql_filter, each filter can be seperated by ‘;’ but it does not work like that for the filter. It further says that the filter can contain a list of several filters, enclosed in parentheses, but it seemingly has nothing to do with one filter for each layer.

I’ve been trying several forms (yes the final requests are url-encoded):

filter=(filterForFirstLayer;filterForSecondLayer)

filter=(filterForFirstLayer);(filterForSecondLayer)

filter=filterForFirstLayer;filterForSecondLayer

I’m sure the solution is easy but I can’t seem to find it.

Thanks,

Aleksander Vines



Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

==

Meet us at GEO Business 2014! in London! Visit http://goo.gl/fES3aK for more information.

==

Dott. Carlo Cancellieri
@cancellieric
Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it




Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Aleksander,
looking at the request and the error seems that you have not escaped the request:
<< When used in a GET request, the XML tag brackets must be URL-encoded.>>
You could try this:

http://meyerweb.com/eric/tools/dencoder/

to escape the url

Cheers,
Carlo

image001.png

···

2014-03-28 15:45 GMT+01:00 Aleksander Vines <aleksander.vines@anonymised.com>:

Thanks for the replies,

Carlo: comma did not work either :frowning:
[http://localhost:8090/geoserver/greensad/wms?LAYERS=layer1,layer2&QUERY_LAYERS=layer1,layer2&STYLES=,&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&BBOX=-138.689604,-68.094802,163.689604,83.094802&FEATURE_COUNT=2000&HEIGHT=400&WIDTH=800&FORMAT=image/png&INFO_FORMAT=text/html&SRS=EPSG:4326&X=368&Y=46&FILTER=(](http://localhost:8090/geoserver/greensad/wms?LAYERS=layer1,layer2&QUERY_LAYERS=layer1,layer2&STYLES=,&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&BBOX=-138.689604,-68.094802,163.689604,83.094802&FEATURE_COUNT=2000&HEIGHT=400&WIDTH=800&FORMAT=image/png&INFO_FORMAT=text/html&SRS=EPSG:4326&X=368&Y=46&FILTER=()<ogc:Filter xmlns:ogc=“http://www.opengis.net/ogc”> … </ogc:Filter>),(<ogc:Filter xmlns:ogc=“http://www.opengis.net/ogc”> … </ogc:Filter>) → “org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1174; Content is not allowed in trailing section. Content is not allowed in trailing section.”

Chris: I was unclear when I mentioned CQL_FILTER, I’m using an OGC-XML-filter (as you see from above). I was just saying that what the documentation said about CQL_FILTERS did not work for the FILTER variable (using semicolon to separate the filters).

Still can’t seem to figure out this, and I’ve started to take a look at the source code myself to try to locate it, but I’m not very familiar with the Geoserver code :slight_smile:

Many thanks,
Aleksander Vines

Chris Snider <chris.snider@anonymised.com> , 3/28/2014 3:26 PM:

I use the CQL_FILTER= with multiple layers.

For Example, layers=BASE:Countries,BASE:States_Provinces&styles=&CQL_FILTER=INCLUDE;Name=’SomeProvinceName’

If you don’t want to restrict a layer result set, use the INCLUDE filter. Or the EXCLUDE if you want to remove it completely.

The filters themselves can be built up to more complexity

CQL_FILTER=(MyAttribute=’Value1’ and MyOtherValue=’Value2’) or MyThirdAttribute=’Value3’

Chris Snider

Senior Software Engineer

Intelligent Software Solutions, Inc.

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

From: carlo cancellieri [mailto:carlo.cancellieri@anonymised.com]
Sent: Friday, March 28, 2014 6:31 AM
To: Aleksander Vines
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] specify a filter for each layer in a GetFeatureInfo request

Aleksander,

I’ve never used them anyhow have you tried with commas?

filter=(FILTER),(FILTER),…

Let me know, we can take a look at the code if needed.

Cheers,

Carlo

2014-03-28 12:34 GMT+01:00 Aleksander Vines <aleksander.vines@anonymised.com>:

Hi list,

according to the documentation at http://docs.geoserver.org/stable/en/user/services/wms/vendor.html#filter : “If more than one layer is specified in the layers parameter then a separate filter can be specified for each layer.”

But it does not say how I can do this, on cql_filter, each filter can be seperated by ‘;’ but it does not work like that for the filter. It further says that the filter can contain a list of several filters, enclosed in parentheses, but it seemingly has nothing to do with one filter for each layer.

I’ve been trying several forms (yes the final requests are url-encoded):

filter=(filterForFirstLayer;filterForSecondLayer)

filter=(filterForFirstLayer);(filterForSecondLayer)

filter=filterForFirstLayer;filterForSecondLayer

I’m sure the solution is easy but I can’t seem to find it.

Thanks,

Aleksander Vines



Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

==

Meet us at GEO Business 2014! in London! Visit http://goo.gl/fES3aK for more information.

==

Dott. Carlo Cancellieri
@cancellieric
Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it




Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

==
Meet us at GEO Business 2014! in London! Visit http://goo.gl/fES3aK for more information.

Dott. Carlo Cancellieri
@cancellieric
Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


Thanks again :slight_smile: I did escapee the request (the paste was decoded for readability in here, also I removed some stuff).

However, I figured it out, the solution was simple, and came to me from the code:

List filters = KvpUtils.readFlat((String) req.getRawKvp().get(“filter”),
KvpUtils.OUTER_DELIMETER);
params.put(“filter”, (String)filters.get(index));

I only need the outer delimiter on each filter, which was “()”
so: filter=(filterForLayer0)(filterForLayer1)

Cheers
Aleksander Vines

carlo cancellieri carlo.cancellieri@anonymised.com , 3/28/2014 4:08 PM:

Aleksander,
looking at the request and the error seems that you have not escaped the request:
<< When used in a GET request, the XML tag brackets must be URL-encoded.>>
You could try this:

http://meyerweb.com/eric/tools/dencoder/

to escape the url

Cheers,
Carlo

2014-03-28 15:45 GMT+01:00 Aleksander Vines <aleksander.vines@anonymised.com>:

Thanks for the replies,

Carlo: comma did not work either :frowning:
[http://localhost:8090/geoserver/greensad/wms?LAYERS=layer1,layer2&QUERY_LAYERS=layer1,layer2&STYLES=,&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&BBOX=-138.689604,-68.094802,163.689604,83.094802&FEATURE_COUNT=2000&HEIGHT=400&WIDTH=800&FORMAT=image/png&INFO_FORMAT=text/html&SRS=EPSG:4326&X=368&Y=46&FILTER=(](http://localhost:8090/geoserver/greensad/wms?LAYERS=layer1,layer2&QUERY_LAYERS=layer1,layer2&STYLES=,&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&BBOX=-138.689604,-68.094802,163.689604,83.094802&FEATURE_COUNT=2000&HEIGHT=400&WIDTH=800&FORMAT=image/png&INFO_FORMAT=text/html&SRS=EPSG:4326&X=368&Y=46&FILTER=()<ogc:Filter xmlns:ogc=“http://www.opengis.net/ogc”> … </ogc:Filter>),(<ogc:Filter xmlns:ogc=“http://www.opengis.net/ogc”> … </ogc:Filter>) → “org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1174; Content is not allowed in trailing section. Content is not allowed in trailing section.”

Chris: I was unclear when I mentioned CQL_FILTER, I’m using an OGC-XML-filter (as you see from above). I was just saying that what the documentation said about CQL_FILTERS did not work for the FILTER variable (using semicolon to separate the filters).

Still can’t seem to figure out this, and I’ve started to take a look at the source code myself to try to locate it, but I’m not very familiar with the Geoserver code :slight_smile:

Many thanks,
Aleksander Vines

Chris Snider <chris.snider@anonymised.com…> , 3/28/2014 3:26 PM:

I use the CQL_FILTER= with multiple layers.

For Example, layers=BASE:Countries,BASE:States_Provinces&styles=&CQL_FILTER=INCLUDE;Name=’SomeProvinceName’

If you don’t want to restrict a layer result set, use the INCLUDE filter. Or the EXCLUDE if you want to remove it completely.

The filters themselves can be built up to more complexity

CQL_FILTER=(MyAttribute=’Value1’ and MyOtherValue=’Value2’) or MyThirdAttribute=’Value3’

Chris Snider

Senior Software Engineer

Intelligent Software Solutions, Inc.

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

From: carlo cancellieri [mailto:carlo.cancellieri@anonymised.com]
Sent: Friday, March 28, 2014 6:31 AM
To: Aleksander Vines
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] specify a filter for each layer in a GetFeatureInfo request

Aleksander,

I’ve never used them anyhow have you tried with commas?

filter=(FILTER),(FILTER),…

Let me know, we can take a look at the code if needed.

Cheers,

Carlo

2014-03-28 12:34 GMT+01:00 Aleksander Vines <aleksander.vines@…6298…>:

Hi list,

according to the documentation at http://docs.geoserver.org/stable/en/user/services/wms/vendor.html#filter : “If more than one layer is specified in the layers parameter then a separate filter can be specified for each layer.”

But it does not say how I can do this, on cql_filter, each filter can be seperated by ‘;’ but it does not work like that for the filter. It further says that the filter can contain a list of several filters, enclosed in parentheses, but it seemingly has nothing to do with one filter for each layer.

I’ve been trying several forms (yes the final requests are url-encoded):

filter=(filterForFirstLayer;filterForSecondLayer)

filter=(filterForFirstLayer);(filterForSecondLayer)

filter=filterForFirstLayer;filterForSecondLayer

I’m sure the solution is easy but I can’t seem to find it.

Thanks,

Aleksander Vines



Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

==

Meet us at GEO Business 2014! in London! Visit http://goo.gl/fES3aK for more information.

==

Dott. Carlo Cancellieri
@cancellieric
Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it




Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

==
Meet us at GEO Business 2014! in London! Visit http://goo.gl/fES3aK for more information.

Dott. Carlo Cancellieri
@cancellieric
Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it




Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

On Fri, Mar 28, 2014 at 3:45 PM, Aleksander Vines <aleksander.vines@anonymised.com...

wrote:

Thanks for the replies,

Carlo: comma did not work either :frowning:

http://localhost:8090/geoserver/greensad/wms?LAYERS=layer1,layer2&QUERY_LAYERS=layer1,layer2&STYLES=,&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&BBOX=-138.689604,-68.094802,163.689604,83.094802&FEATURE_COUNT=2000&HEIGHT=400&WIDTH=800&FORMAT=image/png&INFO_FORMAT=text/html&SRS=EPSG:4326&X=368&Y=46&FILTER=(<ogc:Filter
xmlns:ogc="http://www.opengis.net/ogc&quot;&gt; ... </ogc:Filter>),(<ogc:Filter
xmlns:ogc="http://www.opengis.net/ogc&quot;&gt; ... </ogc:Filter>) --> "org.xml.sax.SAXParseException;
lineNumber: 1; columnNumber: 1174; Content is not allowed in trailing
section. Content is not allowed in trailing section."

Chris: I was unclear when I mentioned CQL_FILTER, I'm using an
OGC-XML-filter (as you see from above). I was just saying that what the
documentation said about CQL_FILTERS did not work for the FILTER variable
(using semicolon to separate the filters).

For OGC filters the WFS documentation is the official reference, I haven't
checked it, but by memory, it's (filter1)(filter2)(...)

Cheers
Andrea

--

Meet us at GEO Business 2014! in London! Visit http://goo.gl/fES3aK
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

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