This one made it through :)
We do have the ability to map geotools functions to sql on the backend (for
speed), although you would need to check how open ended this is.
You may have more luck using the SQL view functionality (which does not
take the detour through OGC Filter).
Let me check how postgis does it:
https://github.com/geotools/geotools/blob/master/modules/plugin/jdbc/jdbc-postgis/src/main/java/org/geotools/data/postgis/FilterToSqlHelper.java#L468
Does not look that open ended to me :)
--
Jody Garnett
On 16 January 2015 at 11:23, Hasan Riaz <hasa...@gmail.com> wrote:
> Hello just wanted to know if my messages are going through. I dont see my
> messages on the geo tools archive
>
> On Wed, Jan 14, 2015 at 7:03 PM, Hasan Riaz <hasa...@gmail.com> wrote:
>
>> Hello to all geotools users,
>> I have a question regarding calling custom database function in a
>> Postgis/postgres database.
>> In normal usage, I use a Filter(OGC filter spec), parse it and then
>> execute a query with the following code:
>>
>> // Create the filter from an input Stream
>> Configuration configuration = new FESConfiguration();
>> Parser parser = new Parser(configuration);
>> Filter filter = (Filter) parser.parse(filterInputStream);
>> filterInputStream.close();
>>
>> // in the params argument I have the database connection information
>> DataStore pgDatastore = DataStoreFinder.getDataStore(params);
>> SimpleFeatureSource featureSource =
>> pgDatastore.getFeatureSource("someTableOrView");
>>
>> // Construct a query object and specify which columns to retrieve
>> Query query = new Query(null, filter, new String[]{ "column1", "column2"
>> });
>>
>> // Now call the database
>> SimpleFeatureCollection collection = featureSource.getFeatures(query);
>> SimpleFeatureIterator iterator = collection.features();
>>
>> Given the above code, and, for example I have a database function with
>> the following definition
>>
>> Name: foo
>> Parameters : parameter1, parameter2, parameter3
>> Returns: column1, column2, column3
>>
>> Here, the result set has multiple columns and not a single return value.
>>
>> Is there a way to use the geotools api to achieve calling the database
>> function with a given filter? Or in more detail, the resultant sql could
>> be(using the above function)
>>
>> Select column1, column2, column3
>> from foo(parameter1, parameter2, parameter3)
>> Where
>> column1 > x And
>> column2 = y And
>> column3 < z;
>>
>> In this case the where and select clauses are generated by a Query object
>> constructed as above.
>> I know this is a different way of using geotools, but needed to know if
>> this is possible.
>>
>> Any help with regards to this would be appreciated,
>> Many Thanks,
>> Hasan
>>
>>
>>
>>
>>
>
>
> ------------------------------------------------------------------------------
> New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
> GigeNET is offering a free month of service with a new server in Ashburn.
> Choose from 2 high performing configs, both with 100TB of bandwidth.
> Higher redundancy.Lower latency.Increased capacity.Completely compliant.
> http://p.sf.net/sfu/gigenet
> _______________________________________________
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users