Ticket #3053 (closed feature: fixed)

Opened 2 years ago

Last modified 2 years ago

Geoserver filter Functions support in OL filter encoding

Reported by: igrcic Owned by:
Priority: major Milestone: 2.11 Release
Component: Format.Filter Version: 2.10
Keywords: Cc:
State: Needs More Work

Description

GS has quite a lot of handy functions by now, so it would be also useful to have them available in OL filters ( http://docs.geoserver.org/2.0.x/en/user/filter/function_reference.html)

Recently GS filter was improved by GeoSolutions with even more advanced filter options that enable us to make advanced queries that combine different layers on Geoserver (you can read more about it on  http://geo-solutions.blogspot.com/2011/02/developer-corner-cross-layer-filtering.html)

Attachments

3053.patch Download (4.1 KB) - added by igrcic 2 years ago.
3053_filterFunctions.patch Download (25.6 KB) - added by igrcic 2 years ago.
3053_filterFunctions2.patch Download (21.3 KB) - added by igrcic 2 years ago.

Change History

Changed 2 years ago by igrcic

Changed 2 years ago by bartvde

  • state changed from Needs Discussion to Needs More Work

igrcic, are you able to add some tests to this patch? TIA.

Changed 2 years ago by igrcic

  • state changed from Needs More Work to Review

Hi Bart,

here is the new version of the patch. This patch adds support for creating function elements inside geometry and comparison filters. Let me describe it shortly.

I introduced new filter Function class, that takes function name, and function parameters as input. Function parameters for now can be literals , or other functions, thus enabling us creation of complex nested filters with functions.

As you can see inside filter class I added writeOgcExpression method that is doing the checkup of the value, and in the case of Function writes out function element, otherwise it assumes its a literal. This function is then used in all comparison filters that were just writing Literals before. Later on, we can add support for other value types, such as PropertyNames.

Included are tests for writing geometry filters with functions and nested functions, as well comparison filter with functions.

Please let me know what you think about it, is there something more I can do, let me know.

Thank you & regards, Ivan

Changed 2 years ago by igrcic

Changed 2 years ago by bartvde

Ivan, can you please elaborate why you changed away from your original approach? That patch was pretty straightforward and small, the new approach is more complex.

Changed 2 years ago by igrcic

Hi Bart,

i did this for several reasons:

The first patch only covered function support in spatial filters (writeSpatial function), the second one also covers other comparison types.

In the first patch I was introducing two new variables inside filter: filter.functionName and filter.functionParams. Later on I thought that using already existing filter.value parameter would be better approach? Together with introducing Funcion class now we can do testing like:

if(filter.value instanceof OpenLayers.Filter.Function) {
    this.writeNode("Function", filter.value, node);
}

writeOgcExpression method can now use this to check the expression type (for now only literal/function with possibility to add other type as PropertyName) and write it accordingly. Before it was only writing literals.

Changed 2 years ago by bartvde

  • state changed from Review to Needs More Work

Hey Ivan, Function.js seems to be missing in your patch, can you add it to your patch? Btw, it might also make sense to ignore whitespace when creating your patch (using svn diff -x -w). TIA.

Changed 2 years ago by igrcic

Changed 2 years ago by igrcic

Sorry about that, i havent done svn add before making diff. Patch with included Function.js added

Changed 2 years ago by bartvde

  • status changed from new to closed
  • resolution set to fixed

(In [11712]) Geoserver filter Functions support in OL filter encoding, p=igrcic,r=me (closes #3053)

Note: See TracTickets for help on using tickets.