Hi,
I would like to add a new filter function to GeoTools that allow regular
expression based
transformations of text.
The function would be called "template", or "patternTemplate", and would
receive up to
3 arguments:
* the first, mandatory, would be a regular expression, including potential
matching groups
* the second, mandatory, would be a template using the matched value and
matching groups
to be expanded, {0} would represent the full matched string, {1} the
first matching group,
{2} the second, and so on
* the third value, optional, would be a default return value in case there
is no match, if missing,
the function would return null
The main use case for this would be to extract bits of complex strings for
processing
or labeling purposes. Say for example that I have an attribute that is
formatted as an ISO
string, and I want to extract only the hour portion of it for labeling, the
call would be:
<ogc:Function name="template">
<ogc:Literal>\d{4}-\d{2}-\d{2}T(\d{2}):\d{2}:\d{2}</ogc:Literal>
<ogc:Literal>{1}</ogc:Literal>
</ogc:Function>
or, in CQL terms:
template('\d{4}-\d{2}-\d{2}T(\d{2}):\d{2}:\d{2}', {1})
Any feedback?
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
-------------------------------------------------------
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel