Hi Thomas,

Yes I agree with you some re-factoring could be done on the Cursor, but it 
takes me two days to found a fix and I don't want to spend more time on 
this at the moment.

&& is fully supported now, through hard-coded operator. The next step is to 
call this operator with all predicates functions, without requesting users 
to use this operator in conjunction with predicate functions.

Currently I have the following predicates (Dev Users will be allowed to 
register their own predicates functions)
ST_Contains, ST_Crosses, ST_Disjoint, ST_Equals, ST_Intersects, 
ST_Overlaps, ST_Touches, ST_Within

The following call :

select * from geotable1 g1, geotable2 g2 where ST_Within(g1.the_geom, 
> g2.the_geom);
>

Should be replaced by

>  select * from geotable1 g1, geotable2 g2 where g1.the_geom && g2.the_geom 
> AND ST_Within(g1.the_geom, g2.the_geom);


Then the idea is to implement the SQL Alias:


create alias _ST_WITHIN FOR 
> "org.h2gis.h2spatial.internal.function.spatial.predicates.ST_Within.isWithin";
>

create alias ST_WITHIN AS ($1 && $2 AND _ST_Within($1,$2));
>

PostGIS do the same thing with PostgreSQL:

> -- Availability: 1.2.2
> -- Inlines index magic
> CREATE OR REPLACE FUNCTION ST_Intersects(geom1 geometry, geom2 geometry)
>     RETURNS boolean
>     AS 'SELECT $1 && $2 AND _ST_Intersects($1,$2)'
>     LANGUAGE 'sql' IMMUTABLE;
>

 I will edit org.h2.expression.JavaFunction, replace $n then create the 
expression as soon I have the arguments.

Thank for support

-Nicolas Fortin
GIS Workshop
IRSTV FR CNRS 2488

Le mercredi 3 juillet 2013 20:28:42 UTC+2, Thomas Mueller a écrit :
>
> Hi,
>
> I will now also have time to help in this area. 
>
> I had a look at your changes in the MVRTreeMap.RTreeCursor class (method 
> min). I wrote a (somewhat randomized) test case but couldn't get the 
> original code to fail so far. I think I understand your changes, but I 
> believe that there should be a simpler solution... With a good test case 
> that should be relatively easier to achieve.
>
> About support for "&&", and possibly other new operators: I think it's 
> best to just hardcode those in the parser. I don't think it's important to 
> allow custom operators in applications. I wonder what the possible 
> operators are, and what is the operator precedence.
>
> Regards,
> Thomas
>
>
>
> On Wed, Jul 3, 2013 at 5:03 PM, Nicolas Fortin (OrbisGIS) <
> [email protected] <javascript:>> wrote:
>
>> MVRTreeMap with Spatial Index works fine, really fast.
>> https://github.com/nicolas-f/h2database/tree/patch-merge
>>
>>  The next step is to create this kind of alias capability :
>>
>>
>> CREATE ALIAS ST_INTERSECTS AS ($1 && $2 AND _ST_INTERSECTS($1,$2));
>>>
>>
>> A kind of Sql Alias.
>>
>> Do you have some comments/advice about this ? 
>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "H2 Database" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/h2-database.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to