I want to edit some fields in a GeoPackage (download a.gpkg)
# -*- coding: utf-8 -*-
from osgeo import ogr
from time import clock
print ("Start",clock())
source = ogr.Open("c:/.../a.gpkg",update=True)
layer = source.GetLayerByName( "263c6845-e2c3-4eee-ae26-f0e9539f3c2bP" )
laydef = layer.GetLayerDefn()
i=0
feature = layer.GetNextFeature()
while feature:
i=i+1
# make some stuff
# .....
layer.SetFeature(feature)
feature = layer.GetNextFeature()
source.Destroy()
print ("Finish",i,clock())
('Start', 3.4136520136791866e-07) ('Finish', 1612, 243.56666043106233)
It works, but it takes a long time (4 minutes for 1.600 records).
What is going wrong?