[gdal-dev] Row count limit in OGR SQL with -dialect=SQLITE

Even Rouault even.rouault at mines-paris.org
Mon Sep 24 11:14:52 PDT 2012


> I will do, I tend to use "limit 10" of something in making quick tests but
> OSM is so odd data that I was not surprised in seeing that it fails. Is
> this driver specific or related to OGR SQL engine generally?

This is specific to the OSM driver needing to be a bit clever about the SQL 
statement that it will have to run. Currently it only uses the analysis 
"engine" of OGR SQL, which fails when non-OGRSQL is used.

> Next question, this one works:
> OSM_data>ogrinfo -dialect SQLITE  finland.osm.pbf -sql "select name,
> amenity from points where amenity is not null" -spat 24.821 60.123 25.259
> 60.317
> 
> But writing to csv file fails, why?
> OSM_data>ogr2ogr -f csv -dialect SQLITE poi.csv finland.osm.pbf -sql
> "select amenity from points where amenity is not null" -spat 24.821 60.123
> 25.259 60.317 csv driver failed to create poi.csv

I've seen that the CSV driver could emit that error message when there's 
already a CSV file in the directory where you want to create the new CSV file,  
and that this existing CSV file cannot be opened successfully for some reason. 
In your both attemps, was it in the same directory ? I bet that if you try to 
create the CSV file in an empty directory, that will work. If the issue is 
linked to such a corrupted CSV file, please file a ticket about that.

> 
> Debug does not show any more information. More odd is that with the
> following I can select attributes from the points layer and write them
> into csv file OSM_data>ogr2ogr -f csv -dialect SQLITE finland.csv
> osm.sqlite  -sql "select distinct name from lines order by name" -spat
> 24.821 60.123 25.259 60.317
> 
> -Jukka-
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list