[Geoserver-devel] How to apply CQL Filter on FeatureType Property that contains Json Object

I have mssql datastore and named layer Compressor generated based on SQL view
query that I want to filter from Openlayer wms request based on Property
EntityUser that contains JSON object with a key.

Sample JSON that contains EntityUser Column/Property is:
        
      {
                "4742ed9e-384c-41fe-9240-8ced1da67759": {
                        "242b5425-2abb-45f1-8f6f-e962ef0861e0":
["746c8188-0125-41f5-aa61-e42c753a77ac"]
                },
                "fff4f98e-cddd-4c7e-aa3e-57e20ec682e9": {
                        "242b5425-2abb-45f1-8f6f-e962ef0861e0":
["746c8188-0125-41f5-aa61-e42c753a77ac"]
                }
        }

So how I apply cql or ogc filter on Property that having JSONObject?

Layer Preview Image:
<http://osgeo-org.1560.x6.nabble.com/file/t381824/cql_filter_on_EntityUser_Property.png&gt;

And also suggest what are all the way possible to filter layer.

--
Sent from: http://osgeo-org.1560.x6.nabble.com/GeoServer-Dev-f3819232.html

Hi,

As far as I know filtering with CQL\OGC Filter\ECQL on the JSON content of a property is not possible, for GeoServer the EntityUser value is just a normal String.

I can see two paths for this:

  • Implement a custom function that would help you dealing with JSON and then use it in the CQL filter

  • for example a function that given a certain path extract the correspond value from JSON

  • create a view, a real view in the database or a GeoServer view, that would put the content of the

Hope it helps,

Nuno Oliveira

···

On 03/20/2018 04:20 AM, C.Ram wrote:

I have mssql datastore and named layer Compressor generated based on SQL view 
query that I want to filter from Openlayer wms request based on Property 
EntityUser that contains JSON object with a key. 

Sample JSON that contains EntityUser Column/Property is: 
        
      { 
                "4742ed9e-384c-41fe-9240-8ced1da67759": { 
                        "242b5425-2abb-45f1-8f6f-e962ef0861e0": 
["746c8188-0125-41f5-aa61-e42c753a77ac"] 
                }, 
                "fff4f98e-cddd-4c7e-aa3e-57e20ec682e9": { 
                        "242b5425-2abb-45f1-8f6f-e962ef0861e0": 
["746c8188-0125-41f5-aa61-e42c753a77ac"] 
                } 
        } 

So how I apply cql or ogc filter on Property that having JSONObject? 

Layer Preview Image:
[<http://osgeo-org.1560.x6.nabble.com/file/t381824/cql_filter_on_EntityUser_Property.png>](http://osgeo-org.1560.x6.nabble.com/file/t381824/cql_filter_on_EntityUser_Property.png) 

And also suggest what are all the way possible to filter layer. 

--
Sent from: [http://osgeo-org.1560.x6.nabble.com/GeoServer-Dev-f3819232.html](http://osgeo-org.1560.x6.nabble.com/GeoServer-Dev-f3819232.html)

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! [http://sdm.link/slashdot](http://sdm.link/slashdot)
_______________________________________________
Geoserver-devel mailing list
[Geoserver-devel@lists.sourceforge.net](mailto:Geoserver-devel@lists.sourceforge.net)
[https://lists.sourceforge.net/lists/listinfo/geoserver-devel](https://lists.sourceforge.net/lists/listinfo/geoserver-devel)

-- 
Regards,
Nuno Oliveira
==
GeoServer Professional Services from the experts! Visit [http://goo.gl/it488V](http://goo.gl/it488V) for more information.
==

Nuno Miguel Carvalho Oliveira
@nmcoliveira
Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:      +39 0584 1660272

[http://www.geo-solutions.it](http://www.geo-solutions.it)
[http://twitter.com/geosolutions_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.

Hi all,

We did something like Nuno's first suggestion in GeoMesa:

https://github.com/locationtech/geomesa/blob/master/geomesa-features/geomesa-feature-kryo/src/main/scala/org/locationtech/geomesa/features/kryo/json/JsonPathFilterFunction.scala

https://github.com/locationtech/geomesa/blob/master/geomesa-features/geomesa-feature-kryo/src/test/scala/org/locationtech/geomesa/features/kryo/json/JsonPathFilterFunctionTest.scala

In the short term, one may be able to drop in the geomesa-feature-kryo jar (with enough dependencies) to make things work.

Cheers,

Jim

On 03/20/2018 04:57 PM, Nuno Oliveira wrote:

Hi,

As far as I know filtering with CQL\OGC Filter\ECQL on the JSON content of a property is not possible, for GeoServer the EntityUser value is just a normal String.

I can see two paths for this:

  * Implement a custom function that would help you dealing with JSON
    and then use it in the CQL filter

      o for example a function that given a certain path extract the
        correspond value from JSON

  * create a view, a real view in the database or a GeoServer view,
    that would put the content of the

Hope it helps,

Nuno Oliveira

On 03/20/2018 04:20 AM, C.Ram wrote:

I have mssql datastore and named layer Compressor generated based on SQL view
query that I want to filter from Openlayer wms request based on Property
EntityUser that contains JSON object with a key.

Sample JSON that contains EntityUser Column/Property is:
                {
                 "4742ed9e-384c-41fe-9240-8ced1da67759": {
                         "242b5425-2abb-45f1-8f6f-e962ef0861e0":
["746c8188-0125-41f5-aa61-e42c753a77ac"]
                 },
                 "fff4f98e-cddd-4c7e-aa3e-57e20ec682e9": {
                         "242b5425-2abb-45f1-8f6f-e962ef0861e0":
["746c8188-0125-41f5-aa61-e42c753a77ac"]
                 }
         }

So how I apply cql or ogc filter on Property that having JSONObject?

Layer Preview Image:
<http://osgeo-org.1560.x6.nabble.com/file/t381824/cql_filter_on_EntityUser_Property.png&gt;

And also suggest what are all the way possible to filter layer.

--
Sent from:http://osgeo-org.1560.x6.nabble.com/GeoServer-Dev-f3819232.html

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org!http://sdm.link/slashdot
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

--
Regards,
Nuno Oliveira

GeoServer Professional Services from the experts! Visithttp://goo.gl/it488V for more information.

Nuno Miguel Carvalho Oliveira
@nmcoliveira
Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272

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.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

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

On Wed, Mar 21, 2018 at 5:38 PM, Jim Hughes <jnh5y@anonymised.com> wrote:

In the short term, one may be able to drop in the geomesa-feature-kryo jar
(with enough dependencies) to make things work.

To work... slowly (against anything by small datasets) as the function is
evaluated in memory.
For good performance, one should also implement translation of the function
down into native SQL
(an exercise left for the reader :wink: )

Cheers
Andrea

==

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.

Right, e.g. PostgreSQL has some support for JSON.

···

On 03/21/2018 05:06 PM, Andrea Aime wrote:

On Wed, Mar 21, 2018 at 5:38 PM, Jim Hughes <jnh5y@…1612…> wrote:

In the short term, one may be able to drop in the geomesa-feature-kryo jar (with enough dependencies) to make things work.

To work… slowly (against anything by small datasets) as the function is evaluated in memory.
For good performance, one should also implement translation of the function down into native SQL
(an exercise left for the reader :wink: )

Cheers
Andrea

==

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.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! [http://sdm.link/slashdot](http://sdm.link/slashdot)
_______________________________________________
Geoserver-devel mailing list
[Geoserver-devel@lists.sourceforge.net](mailto:Geoserver-devel@lists.sourceforge.net)
[https://lists.sourceforge.net/lists/listinfo/geoserver-devel](https://lists.sourceforge.net/lists/listinfo/geoserver-devel)

-- 
Regards,
Nuno Oliveira
==
GeoServer Professional Services from the experts! Visit [http://goo.gl/it488V](http://goo.gl/it488V) for more information.
==

Nuno Miguel Carvalho Oliveira
@nmcoliveira
Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:      +39 0584 1660272

[http://www.geo-solutions.it](http://www.geo-solutions.it)
[http://twitter.com/geosolutions_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.