Le samedi 01 octobre 2016 08:20:06, Michael Sumner a écrit : > Hello, I'm seeing that the OGRSQL virtual FID value is 0-based for > shapefile, and 1-based for MapInfo (TAB or MIF). > > Is this driver-dependent generally, or is shapefile (or MI?) a special > case?
There's no general rule. I think 1-based must be more common among drivers though. I see GeoJSON is 0-based (if the GeoJSON has no id member) SQLite/GPKG : 1-based (at least when OGR creates the FID) KML: 0-based but LIBKML: 1-based > > Using the autotest data I see > > ## no feature returned (there are 2) > ogrinfo autotest/ogr/data/seamless_part1.tab -sql "SELECT * FROM > seamless_part1 WHERE FID = 0" > > ## one feature returned > ogrinfo autotest/ogr/data/seamless_part1.tab -sql "SELECT * FROM > seamless_part1 WHERE FID = 2" > > ## create analogous SHP > ogr2ogr shp autotest/ogr/data/seamless_part1.tab seamless_part1 > > ## one feature returned > ogrinfo shp -sql "SELECT * FROM seamless_part1 WHERE FID = 0" > > ## no feature returned > ogrinfo shp -sql "SELECT * FROM seamless_part1 WHERE FID = 2" > > Cheers, Mike. -- Spatialys - Geospatial professional services http://www.spatialys.com _______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev