Bug report #707
extent() wrong for newly created layers
|Affected QGIS version:||Regression?:||No|
|Operating System:||Linux||Easy fix?:||No|
|Pull Request or Patch supplied:||Resolution:||fixed|
|Crashes QGIS or corrupts data:||Copied to github as #:||10766|
Quite simply, when you create a new vector layer it seems the extents are wrong. Here's the full details:
Start qgis, load any old vector/raster layer just to get some well-defined view, then do Layer... 'New Vector Layer'. Give it an attribute and a name to save. The layer will be saved in a shapefile in a directory with that name.
Right click the layer in the legend and 'allow editing'. Use the 'Capture Point' tool to make some points and fill in the attribute value.
Right click the layer in the legend and go 'Properties', metadata tab shows extent, and the minx and miny are wrong - (0,0).
Deselect 'Allow Editing', and OK the 'save' dialog. Metadata tab extent still wrong.
Remove the layer from Qgis. Now add it back with the 'Add Vector Layer' menu entry - select the shapefile of the layer we just added with the editing tools. Props... Metadata... and the extent is correct...
#1 Updated by browlingson - over 14 years ago
Hunted this down a bit. This only seems to happen if you add the points in the positive quadrant, ie NorthEast of (0,0). As soon as you add a point in the negative region the extent is correct.
The initial qgis view extent is (-1,-1) to (1,1), so if you start a fresh qgis try creating a new points layer in the top right, you should see the extent() fail to update.