I want to add the fid to the attribute table using ogrinfo in OSGeo4W Shell.
Here is my code:
ogrinfo layer.shp -sql "ALTER TABLE layer ADD COLUMN ID integer" ogrinfo layer.shp -dialect SQLite -sql "UPDATE layer SET ID = FID"
The GDAL:OGR SQL help https://www.gdal.org/ogr_sql.html points out that sometimes it is necessary to add the fid as a column, as it is the case for me.
Does anyone has a clue how to solve this? Maybe by iterating a rownumber?