OGR ODBC spatial query has invalid resultset

Frank Warmerdam warmerdam at POBOX.COM
Tue Sep 26 09:42:05 EDT 2006


Fabio D'Ovidio wrote:
> Frank, please, what is wrong with this ??
...

     END
>             CONNECTIONTYPE OGR
>   CONNECTION "puglia/pug_iffi.shp"
>  DATA "SELECT * from pug_iffi c LEFT JOIN 
> 'ODBC:sa/@CartanetIFFI'.Query_IdFrana b ON c.IDFRANA = (b.cod_pro + b.id 
> + b.subid)"
>   END
> 
> It doesn't work !

Fabio,

I believe the problem is that the join operation is being evaluated by
OGR, and the OGR "pseudo-SQL" interpreter does not know how to evaluate
operations like "(b.cod_pro + b.id > + b.subid)".  It only knows how to
do very simple key to key joins.

So, in this case the limited nature of OGR SQL joins is failing you.

This might work if you could create a regular column on your ODBC table
with the merged key.  I will warn that OGR joins tend to be slow since
each joined record is fetched by a distinct SQL SELECT operation.  So you
should only use it for small numbers of records.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org



More information about the mapserver-users mailing list