You are thinking about it wrong relatePattern is a function - which is a
kind of expression. You can compare the result of the function using the
equals filter - if you wanted to use it to select content.

Let me provide you a code example (forgive me if this does not work as I am
just typing it into an email from memory).

FilterFactory ff = CommonFactoryFinder.getFilterFactory2(null);

LineString line = (LineString) reader.read("LINESTRING(0 2, 2 0, 8 6)");
Expression expr = ff.function("relatePattern", ff.propert("the_geom"),
ff.literal( linestring), ff.literal("***1*****") );

Filter filter = ff.equals( expr, ff.literal( Boolean.TRUE ) );


On Fri, Jul 1, 2011 at 9:38 PM, Matthias Lendholt <
[email protected]> wrote:

> None of them
>
> http://docs.geotools.org/**latest/javadocs/org/geotools/**
> filter/FilterFactory.html<http://docs.geotools.org/latest/javadocs/org/geotools/filter/FilterFactory.html>
> http://docs.geotools.org/**latest/javadocs/org/opengis/**
> filter/FilterFactory.html<http://docs.geotools.org/latest/javadocs/org/opengis/filter/FilterFactory.html>
> http://docs.geotools.org/**latest/javadocs/org/opengis/**
> filter/FilterFactory2.html<http://docs.geotools.org/latest/javadocs/org/opengis/filter/FilterFactory2.html>
>
> provide a relatePattern or any other 'relate' or 'de9im' filter. Or do I
> have the wrong version / java doc?
>
> Matthias
>
>
> Am 01.07.2011 13:30, schrieb Jody Garnett:
>
>> They do provide a function - so you should be able to create a
>> "relatePattern" function call. If that works we have a clear reason (and
>> code example) to create a issue report in the JIRA issue tracker.
>>
>> --
>> Jody Garnett
>>
>> On Friday, 1 July 2011 at 9:14 PM, Matthias Lendholt wrote:
>>
>>  Because CQL accepts "intersects(the_geom, LINESTRING (27.3 37, 27.3
>>> 37.6))" I thought it should work the same for relatePattern.
>>>
>>> Neither FilterFactory nor FilterFactory2 provide a RelatePattern filter.
>>>
>>> However, the inner StaticGeometry class provides
>>> static String relatePattern(Geometry arg0, Geometry arg1, String arg2)
>>> exist.
>>>
>>> Matthias
>>>
>>>
>>> Am 01.07.2011 12:00, schrieb Jody Garnett:
>>>
>>>> You may need to call a function to parse your string into a geometry? I
>>>> am not sure how the CQL parser handles things - perhaps it only expects
>>>> geometry literals for spatial filters??
>>>>
>>>> Try using FilterFactory and check if the function works for you?
>>>>
>>>> --
>>>> Jody Garnett
>>>>
>>>> On Friday, 1 July 2011 at 1:45 AM, Matthias Lendholt wrote:
>>>>
>>>>
>>>>> Am 30.06.2011 14:28, schrieb Jody Garnett:
>>>>>
>>>>>> The complete function list is in the docs here:
>>>>>> -
>>>>>>
>>>>> http://docs.geotools.org/**latest/userguide/library/main/**
>>>>> filter.html#function-list<http://docs.geotools.org/latest/userguide/library/main/filter.html#function-list>
>>>>>
>>>>> yeah, thanks. I already trid it, but I still get this exception. The
>>>>> second geometry (WKT) is not accepted.
>>>>>
>>>>>
>>>>> Caused by: org.geotools.filter.text.cql2.**CQLException: Encountered
>>>>> "LINESTRING" at line 1, column 25.
>>>>> Was expecting one of:
>>>>> <STRING_LITERAL> ...
>>>>> "true" ...
>>>>> "false" ...
>>>>> "(" ...
>>>>> "[" ...
>>>>> <INTEGER_LITERAL> ...
>>>>> <FLOATING_LITERAL> ...
>>>>> <IDENTIFIER> ...
>>>>> . Parsing : relatePattern(the_geom, LINESTRING (27.3 37, 27.3
>>>>> 37.6),***1*****). Current Token : ","
>>>>> at
>>>>> org.geotools.filter.text.cql2.**CQLCompiler.compileFilter(**
>>>>> CQLCompiler.java:106)
>>>>> at
>>>>> org.geotools.filter.text.**commons.CompilerUtil.**
>>>>> parseFilter(CompilerUtil.java:**194)
>>>>> at org.geotools.filter.text.cql2.**CQL.toFilter(CQL.java:131)
>>>>> at org.geotools.filter.text.cql2.**CQL.toFilter(CQL.java:110)
>>>>> at ...
>>>>>
>>>>> org.geotools.filter.text.**generated.parsers.CQLParser is not part of
>>>>> geotools-2.6.5-project.zip and therefore I cannot debug it.
>>>>>
>>>>>
>>>>> I tested other functions and they work:
>>>>> intersects(the_geom, LINESTRING (27.3 37, 27.3 37.6)) works...
>>>>>
>>>>> Cheers, Matthias
>>>>>
>>>>>
>>>>>  --
>>>>>> Jody Garnett
>>>>>>
>>>>>> On Thursday, 30 June 2011 at 9:42 PM, Matthias Lendholt wrote:
>>>>>>
>>>>>>  Hi all,
>>>>>>>
>>>>>>> How do I get a RELATES/DE9IM filter with CQL? I'm looking for a
>>>>>>> filter
>>>>>>> similar to this postgis function:
>>>>>>> boolean ST_Relate(geometry geomA, geometry geomB, text
>>>>>>> intersectionMatrixPattern);
>>>>>>>
>>>>>>> I tried it with CQL.toFilter("relates(the_**geom," + refGeomAsWKT+
>>>>>>> ",'" +
>>>>>>> de9impattern + "')"); and changed the parameter order but never was
>>>>>>> successful.
>>>>>>>
>>>>>>> Any ideas?
>>>>>>> Many thanks, Matthias
>>>>>>>
>>>>>>
>>>
>>> --
>>> [matthias.lendholt@gfz-**potsdam.de <[email protected]>
>>> <mailto:matthias.lendholt@gfz-**potsdam.de<[email protected]>
>>> >]
>>>
>>> GFZ German Research Centre for Geosciences
>>> CeGIT Centre for GeoInformation Technology
>>> Tel +49 331 288-1687; FAX +49 331 288-1703
>>> Telegrafenberg A20, 14473 Potsdam, Germany
>>> Blog 
>>> http://zeigertelegraph.gfz-**potsdam.de<http://zeigertelegraph.gfz-potsdam.de>
>>> Contact MECARD QR Code: http://goo.gl/488J
>>>
>>
>>
>
> --
> [matthias.lendholt@gfz-**potsdam.de <[email protected]>]
> GFZ German Research Centre for Geosciences
> CeGIT Centre for GeoInformation Technology
> Tel +49 331 288-1687; FAX +49 331 288-1703
> Telegrafenberg A20, 14473 Potsdam, Germany
> Blog 
> http://zeigertelegraph.gfz-**potsdam.de<http://zeigertelegraph.gfz-potsdam.de>
> Contact MECARD QR Code: http://goo.gl/488J
>
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to