[gdal-dev] SQL FID 0- or 1-based
Michael Sumner
mdsumner at gmail.com
Fri Sep 30 23:20:06 PDT 2016
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?
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.
--
Dr. Michael Sumner
Software and Database Engineer
Australian Antarctic Division
203 Channel Highway
Kingston Tasmania 7050 Australia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20161001/5fb04761/attachment.html>
More information about the gdal-dev
mailing list