Skip to content
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

"Save as..." does not work for rasters #22211

Closed
qgib opened this issue Feb 1, 2016 · 9 comments
Closed

"Save as..." does not work for rasters #22211

qgib opened this issue Feb 1, 2016 · 9 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Rasters Related to general raster layer handling (not specific data formats)
Milestone

Comments

@qgib
Copy link
Contributor

qgib commented Feb 1, 2016

Author Name: Alexander Bruy (@alexbruy)
Original Redmine Issue: 14209
Affected QGIS version: master
Redmine category:rasters


To reproduce

  1. start QGIS and load landcover.img from "Alaska dataset":http://qgis.org/downloads/data/qgis_sample_data.zip
  2. from layer context menu choose "Save as..." and try to save raster in GeoTiff format
  3. saving failed, output layer can not be loadded in QGIS with message
Raster layer: /tmp/test.tif is not a supported raster data source
(src/app/qgisapp.cpp : 10501 : addRasterLayers)

In console I see this```
src/core/qgsproviderregistry.cpp: 462: (function) [0ms] Library name is /home/alex/devel/cpp/qgis/build/output/lib/qgis/plugins/libgdalprovider.so
src/providers/gdal/qgsgdalprovider.cpp: 2754: (create) [0ms] create options:
ERROR 1: Attempt to create 0x0 dataset is illegal,sizes must be larger than zero.
src/providers/gdal/qgsgdalprovider.cpp: 2764: (create) [1ms] Cannot create new dataset /tmp/test.tif:
Attempt to create 0x0 dataset is illegal,sizes must be larger than zero.
src/providers/gdal/qgsgdalproviderbase.cpp: 29: (QgsGdalProviderBase) [0ms] Entered
src/providers/gdal/qgsgdalprovider.cpp: 227: (~QgsGdalProvider) [0ms] entering.
src/core/qgsproviderregistry.cpp: 462: (function) [0ms] Library name is /home/alex/devel/cpp/qgis/build/output/lib/qgis/plugins/libgdalprovider.so
ERROR 4: `/tmp/test.tif' does not exist in the file system,
and is not recognised as a supported dataset name.

It works fine in 2.12, but fails in master.



---

- [saveas.png](https://issues.qgis.org/attachments/download/9529/saveas.png) (Alexander Bruy)
@qgib
Copy link
Contributor Author

qgib commented Feb 1, 2016

Author Name: Luigi Pirelli (@luipir)


confirmed with the following revision beaa45e

src/providers/gdal/qgsgdalprovider.cpp: 2480: (bandStatistics) [0ms] STDDEV 3.03972
src/core/qgsproviderregistry.cpp: 462: (function) [0ms] Library name is /home/ginetto/PROGRAMMING/QGIS-Boundless/build/output/lib/qgis/plugins/libgdalprovider.so
src/providers/gdal/qgsgdalprovider.cpp: 2754: (create) [0ms] create options: 
ERROR 1: Attempt to create 0x0 dataset is illegal,sizes must be larger than zero.
src/providers/gdal/qgsgdalprovider.cpp: 2764: (create) [0ms] Cannot create new dataset  /home/ginetto/Downloads/pippo.tif:
Attempt to create 0x0 dataset is illegal,sizes must be larger than zero.
src/providers/gdal/qgsgdalproviderbase.cpp: 29: (QgsGdalProviderBase) [0ms] Entered
src/providers/gdal/qgsgdalprovider.cpp: 227: (~QgsGdalProvider) [1ms] entering.
src/core/qgsproviderregistry.cpp: 462: (function) [0ms] Library name is /home/ginetto/PROGRAMMING/QGIS-Boundless/build/output/lib/qgis/plugins/libgdalprovider.so
ERROR 4: `/home/ginetto/Downloads/pippo.tif' does not exist in the file system,
and is not recognised as a supported dataset name.

@qgib
Copy link
Contributor Author

qgib commented Feb 3, 2016

Author Name: Radim Blazek (@blazek)


I found the raster save as dialog pretty broken. CRS and size/resolution are not set correctly by default, which results for example in "Attempt to create 0x0 dataset".


  • assigned_to_id removed Radim Blazek

@qgib
Copy link
Contributor Author

qgib commented Feb 3, 2016

Author Name: Nyall Dawson (@nyalldawson)


Radim - looks ok to me. What circumstances do you see the incorrect values?

@qgib
Copy link
Contributor Author

qgib commented Feb 3, 2016

Author Name: Alexander Bruy (@alexbruy)


Also looks fine here. Extent, CRS and size set correctly. Screenshoot attached.


  • 9529 was configured as saveas.png

  • saveas.png (Alexander Bruy) - Screenshot of "Save as" dialog with correct values

@qgib
Copy link
Contributor Author

qgib commented Feb 3, 2016

Author Name: Radim Blazek (@blazek)


I have Settings > Options > CRS > Don't enable 'on the fly' reprojection

If I add landcover.img (EPSG 2964, 3663x1964, resolution 3280) and open save as, it is set to:

CRS: EPSG 4326
Extent: -179.96750606303607, 49.18115186042209, 179.99678395391788, 71.42336747479702
Resolution 3280, 3280
Size: 0, 0

It should be set to the original raster values. In any case, extent is in EPSG 4326 while resolution in EPSG 2964, that is also why the size is 0x0.

Alexander Bruy wrote:

Also looks fine here. Extent, CRS and size set correctly. Screenshoot attached.

Correctly? Is not the size 0x0? Does not that fail with "Attempt to create 0x0 dataset"?

@qgib
Copy link
Contributor Author

qgib commented Feb 3, 2016

Author Name: Nyall Dawson (@nyalldawson)


Does this happen every time for you? I can't reliably reproduce it. For me (with OTF off) it defaults to the project CRS, and the derived values are correctly set.

I'm not sure if the dialog should default to the layer CRS or project CRS, but that's a different discussion....

@qgib
Copy link
Contributor Author

qgib commented Feb 4, 2016

Author Name: Radim Blazek (@blazek)


Playing with landcover.img, I found more serious #22227.

Nyall Dawson wrote:

Does this happen every time for you? I can't reliably reproduce it. For me (with OTF off) it defaults to the project CRS, and the derived values are correctly set.

Excent/resolution/size are initially wrong only if project is in geographic CRS. If you switch then manually in save as dialog to another (or even to the same) CRS, the values are corrected.

I'm not sure if the dialog should default to the layer CRS or project CRS, but that's a different discussion....

I believe that default should be layer's CRS, extent and size, otherwise data are lost and that should only happen intentionally (manually select). Apart loosing data, it can also result in huge output raster, take for example our example, if output CRS for landcover.img is set to epsg:4326, it calculates resolution 0.000951617,0.0126326 and size 378266,1761! Hardly useful.

@qgib
Copy link
Contributor Author

qgib commented Mar 14, 2016

Author Name: Nyall Dawson (@nyalldawson)


Fixed in changeset "8fc405648be18870133e318cbfc7cb0918efe4b1".


  • status_id was changed from Open to Closed

@qgib
Copy link
Contributor Author

qgib commented Mar 14, 2016

Author Name: Nyall Dawson (@nyalldawson)


Should be fixed with #22373, and the above commit switches the default CRS to match the layer CRS rather than the project CRS.

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Rasters Related to general raster layer handling (not specific data formats) labels May 25, 2019
@qgib qgib added this to the Version 2.14 milestone May 25, 2019
@qgib qgib closed this as completed May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Rasters Related to general raster layer handling (not specific data formats)
Projects
None yet
Development

No branches or pull requests

1 participant