[gdal-dev] VirtualOGR with Sqlite

Even Rouault even.rouault at mines-paris.org
Tue Jan 1 12:55:36 PST 2013


Le mardi 01 janvier 2013 21:45:10, Martin Jensen a écrit :
> I have been playing around with the virtualOGR table feature made available
> in sqlite and I am absolutely thrilled about this feature.Thanks for the
> great work!
> 
> I've come across two small issues that i'd like some help/comments on. I am
> trying to connect to a WFS service which works fine in Sqlite.
> 
> 
> 1) connecting to all layers in an ogr (WFS) datasource
> 
>  I wanted to try to connect to all layers in the WFS datasource at once.
> The sqlite driver page says it is possible with the function
> "ogr_datasource_load_layers"  http://www.gdal.org/ogr/drv_sqlite.html, I
> get the error:
> 
> no such function: ogr_datasource_load_layers
> 
> I am using Spatialite 4.0.0 and GDAL 1.10dev from trunk

This has been added yesterday, so maybe your checkout isn't recent enough.

> 
> 2) Using sql with  "....limit 10;"
> 
> All works find using the "create table using virtualOGR()". I was then
> hoping I could use sql syntax "limit 10" on the wfs datasource because it
> is a huge dataset. But it seems that the virtual table has fecth the entire
> dataset before retuning the 10 rows. I was thinking the "limit 10" was
> translated to &maxfeatures=10 in the WFS drivers GetFeature request. Is
> this expected behaviour or am I doing something wrong?

The limit clause isn't passed to OGR, but only used by the SQLite engine, so 
yes this is somehow an expected behaviour. However, the download should be 
partial - prehaps a bit more than 10 features, but not the whole layer if it 
is bit - if you iterate only over a few features. I've just tested it actually 
and could see the difference on a big enough layer. You can also workaround 
that by just adding "&MAXFEATURES=10" in your connexion string.

Best regards,

Even



More information about the gdal-dev mailing list