-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty Temporary scratch layer made permanent is not editable. #38834
Comments
@ValPinnaSardinia Cannot confirm here, at least on Linux. |
I confirm OSGeo4W64 WIn 10 |
@pigreco @ValPinnaSardinia works fine on Windows too here. Please try with a new QGIS profile. |
I have tried with a new clean profile and I confirm that I have the same problem. |
Ok, probably I'm doing it wrong, I will test again later. |
I confirm |
@gioman I can confirm also with 3.4 (GDAL/OGR 2.4.0) and 2.18 (GDAL/OGR 2.2.4) on Windows. Minimal procedure:
It seems that in QGIS it is not possible to add a geometry feature or a field to a shapefile without at least 1 field. So it's not editable de facto. If the shapefile without at least 1 field contains geometries, then is possible to edit the feature geometries but not to add new feature geometries or fields. Another way to generate a shapefile without at least 1 field is: create a shapefile with 1 field (it is not possible to create a shapefile without at least 1 field using the QGIS GUI) and then remove the field and remove and readd the shapefile. In https://gdal.org/drivers/vector/shapefile.html it is stated that: Anyway I think this is a bug. It should be possible to add fields to a shapefile without fields (or, at least, a warning should be displayed when a vector layer without fields is "made permanent" or saved to a shapefile" or when all the fields are deleted from a shapefile). With ArcGIS/ArcMap 9 it is possible without problem to add features and fields to a shapefile without fields. In the ESRI Shapefile Technical Description there are no constraints on the number of field in the dbf attribute table. The problem should be in the ogr data provider and in the way it calculates the layer capabilities. For a shapefile layer without at least 1 field the following capabilities are reported by the ogr data provider: |
@agiudiceandrea or ogr itself? from what you describe seems an upstream issue(?). |
Using ogrinfo cli tool it is possible to add a field to a shapefile without fields. |
Confirmed also with QGIS 3.14 on Ubuntu Linux 18.04 (GDAL/OGR 2.2.3) and 20.04 (GDAL/OGR 3.0.4). |
It seems the relevant code is at QGIS/src/core/providers/ogr/qgsogrprovider.cpp Lines 2832 to 2849 in 73626bd
The capability limitation for shapefiles w/o attributes was introduced a long long time ago: bf62b39 |
@rouault is this a limitation of the GDAL/OGR library or can we fix it QGIS-side? |
Issue
After recording a weird behaviour with some layers, I have realised that when a new Temporary scratch layer is made permanent (as .shp) before adding to it any new feature or field, it becomes not editable.
The new layer does not accept new features or new fields. Also, trying to use the Field calculator to create a new field, it appears the message This layer does not support adding new provider fields. You can only add virtual fields.
Also removing and readding the layer to the project doesn't solve the problem.
How to Reproduce
QGIS and OS versions
Tried on QGIS 3.10.10, 3.14.16 and dev 3.15 on Windows 8 and 10
The text was updated successfully, but these errors were encountered: