Bug report #15273

Geopackage layer extent wrong

Added by Giovanni Manghi about 4 years ago. Updated almost 4 years ago.

Status:Closed
Priority:Normal
Assignee:Even Rouault
Category:Data Provider/OGR
Affected QGIS version:2.16.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:23209

Description

  • Create a geopackage db/layer from scratch, polygon for example.
  • add a few feature, save edits
  • zoom to layer > o far so good
  • edit the layer removing feature(s) (at least one near the bbox of the layer)
  • save edits
  • zoom to layer > extent is wrong, as if the deleted feature are still there
  • "update extent" does nothing, as also rmeoving/adding the layer again, or closing QGIS

Associated revisions

Revision 70ae3013
Added by Even Rouault almost 4 years ago

[OGR provider] Update layer extent for GPKG layers

When moving or deleting a geometry that previously touched the layer extent,
the layer extent was never shrinked.

This fix requires GDAL 2.1.2 or above as well.

Fixes #15273

Revision 9d316b01
Added by Even Rouault almost 4 years ago

[OGR provider] Update layer extent for GPKG layers

When moving or deleting a geometry that previously touched the layer extent,
the layer extent was never shrinked.

This fix requires GDAL 2.1.2 or above as well.

Fixes #15273

Revision d2299c1f
Added by Even Rouault almost 4 years ago

[OGR provider] Update layer extent for GPKG layers

When moving or deleting a geometry that previously touched the layer extent,
the layer extent was never shrinked.

This fix requires GDAL 2.1.2 or above as well.

Fixes #15273

Revision 70186ee2
Added by Even Rouault almost 4 years ago

[OGR provider] Update layer extent for GPKG layers

When moving or deleting a geometry that previously touched the layer extent,
the layer extent was never shrinked.

This fix requires GDAL 2.1.2 or above as well.

Fixes #15273

History

#1 Updated by Even Rouault almost 4 years ago

The layer extent is stored in the gpkg_contents system table, but the extent can only grow. If it shrinks, a full rescan of the whole layer should be done to recompute it.

#2 Updated by Giovanni Manghi almost 4 years ago

Even Rouault wrote:

The layer extent is stored in the gpkg_contents system table, but the extent can only grow. If it shrinks, a full rescan of the whole layer should be done to recompute it.

Is this considered an upstream (format?) bug... or feature?

#3 Updated by Even Rouault almost 4 years ago

It is a feature shared by all formats that save an extent in their metadata (shapefiles have the same issues, unless you compact them). There's no fast way to update the layer extent when updating or removing features, apart from rescanning the whole layer. So of course this can be forced (would probably make sense in being implement by a special SQL command in the OGR GeoPackage driver), and could be likely done at the end of an edit session.

#4 Updated by Even Rouault almost 4 years ago

  • Status changed from Open to Closed

#5 Updated by Even Rouault almost 4 years ago

  • Target version set to Version 2.14
  • Category changed from Vectors to Data Provider/OGR
  • Assignee set to Even Rouault

Fix requires GDAL 2.1.2 or later to work

Also available in: Atom PDF