[gdal-dev] SQL FID 0- or 1-based

Michael Sumner mdsumner at gmail.com
Fri Sep 30 23:23:09 PDT 2016


I forgot to add that I'm using 2.1.1, on Debian sid.

GDAL 2.1.1, released 2016/07/07

Cheers, Mike.



On Sat, 1 Oct 2016 at 16:20 Michael Sumner <mdsumner at gmail.com> wrote:

> 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
>
> --
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/ea5dc910/attachment.html>


More information about the gdal-dev mailing list