You can fix it using ogrinfo
or sqlite3
by running the following for ogrinfo
. You will need to replace ocurences of 3857
by your own SRID code and my_table_name
ocurences with your own table name too
# Work well because only one geometry column for table name
ogrinfo my.gpkg \
-sql "UPDATE gpkg_geometry_columns SET srs_id = 3857 WHERE table_name = 'my_table_name'" \
--config OGR_GPKG_FOREIGN_KEY_CHECK OFF
# Dialect SQLite to get the SetSRID function available
ogrinfo my.gpkg -dialect SQlite -sql "UPDATE my_table_name set geom = SetSRID(geom, 3857)"
and with sqlite3
command line:
sqlite3 my.gpkg "UPDATE gpkg_geometry_columns SET srs_id = 2154 WHERE table_name = 'my_table_name'"
sqlite3 my.gpkg "select load_extension('mod_spatialite');UPDATE my_table_name set geom = SetSRID(geom, 3857);"