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

Add Data Type to Raster Calculator #14402

Closed
qgib opened this issue Nov 1, 2011 · 16 comments
Closed

Add Data Type to Raster Calculator #14402

qgib opened this issue Nov 1, 2011 · 16 comments
Labels
Feature Request Rasters Related to general raster layer handling (not specific data formats)

Comments

@qgib
Copy link
Contributor

qgib commented Nov 1, 2011

Author Name: alobo - (alobo -)
Original Redmine Issue: 4475

Redmine category:rasters
Assignee: Marco Hugentobler


The former plugin Raster Calc had the option of selecting a given Data Type (i.e Int16, Float32 etc)
for the output. This was most useful and is not present in the current Raster Calculator


@qgib
Copy link
Contributor Author

qgib commented Nov 12, 2011

Author Name: Tim Sutton (Tim Sutton)


  • fixed_version_id was changed from Version 1.7.1 to Version 1.7.2

@qgib
Copy link
Contributor Author

qgib commented Nov 23, 2011

Author Name: Zdenek Ruzicka (Zdenek Ruzicka)


Hi, I have tried to write patch.


  • 3565 was configured as patchRastCalc

@qgib
Copy link
Contributor Author

qgib commented Nov 23, 2011

Author Name: Giovanni Manghi (@gioman)


  • pull_request_patch_supplied was changed from 0 to 1

@qgib
Copy link
Contributor Author

qgib commented Nov 24, 2011

Author Name: Richard Duivenvoorde (@rduivenvoorde)


Hi Zdenek, thanks for the patch! thought to give the patch a try :-)

Gui looks nice (maybe a little less wider?)

Trying the datatype dropdown on a ecw I have here (I'm no rasterman...), selecting certain types from the dropdown will more or less hang qgis, showing zillion of warnings in the debug window:
"Warning: GDAL data type is not supported " (eg with the type CInt32).

Is the elements of the Pixel format dropdown dynamic? I mean, should it maybe be checked by the underlying lib which types are available or so? Or maybe testing after one pixel if there is this warning and then come back with some message to optionally break off?

Please let us know if you find time to have a look in it, otherwise maybe somebody else should have a look into it.


  • status_id was changed from Open to Feedback
  • fixed_version_id was changed from Version 1.7.2 to Version 1.8.0

@qgib
Copy link
Contributor Author

qgib commented Nov 25, 2011

Author Name: Zdenek Ruzicka (Zdenek Ruzicka)


Hi Richard, thanks for trying.

Elements of the Pixel format dropdown are chosen dynamically from metadata of each driver (using GDALGetMetadataItem( ) and look for GDAL_DMD_CREATIONDATATYPES), only if in metadata is nothing about supported pixel data types, it show you all GDAL supported pixel data formats.

It looks that there is some problem with that complex pixel data types, Raster Calculator write into the file, problem 'begin' during opening it :). It looks that gdalinfo has no problem with it. I tried save data using python plugin RasterCalc and there is same problem.

I will look at it more in deep.

@qgib
Copy link
Contributor Author

qgib commented Nov 25, 2011

Author Name: Zdenek Ruzicka (Zdenek Ruzicka)


Does QGIS support rastar data saved in complex pixel data types (eg CFloat32) at all?

I am asking, because I tried open file which I created using Raster Calculator (GeoTIFF,CFloat32) and opened it in Grass with success. And I also made GeoTIFF with CFloat32 pixel data format using Grass and I can't open it in QGIS (same warnings: "Warning: GDAL data type is not supported").

@qgib
Copy link
Contributor Author

qgib commented Dec 24, 2011

Author Name: Giovanni Manghi (@gioman)


Can someone review the attached patch?

@qgib
Copy link
Contributor Author

qgib commented Dec 24, 2011

Author Name: Richard Duivenvoorde (@rduivenvoorde)


I tested it (see #4) and found some issues. But I cannot answer the question of Zdenek.

Maybe he (or we) can ask the question on the devlist? And then based on that he can do an updated patch?

@qgib
Copy link
Contributor Author

qgib commented Dec 30, 2011

Author Name: Marco Hugentobler (@mhugent)


  • assigned_to_id was configured as Marco Hugentobler

@qgib
Copy link
Contributor Author

qgib commented Dec 30, 2011

Author Name: Marco Hugentobler (@mhugent)


The patch looks good and adds important functionality to the raster calculator.

There is however one problem with the patch. The GDAL doc says that the array passed to RasterIO for writing needs to have output type. With the patch, calcData is still hardcoded float*, even though the output type can be different:

float* calcData;
.....
GDALDataType pixelFormatDGT = GDALGetDataTypeByName( mOutputPixelFormat.toLocal8Bit().data() );
if ( GDALRasterIO( outputRasterBand, GF_Write, 0, i, mNumOutputColumns, 1, calcData, mNumOutputColumns, 1, pixelFormatDGT, 0, 0 ) != CE_None )

It would be great if you could improve that part of the patch.

@qgib
Copy link
Contributor Author

qgib commented Dec 30, 2011

Author Name: Zdenek Ruzicka (Zdenek Ruzicka)


Thanks, I will look at this (float* calcData;...).

But still I am not sure whether QGIS can read rastar data saved in complex pixel data types (eg CFloat32). I made one file using gdal_translate (gdal_translate -ot CFloat32 -of GTiff elevation.tif elevationGDAL_CFloat32.tif) and still I can't open it in QGIS.

@qgib
Copy link
Contributor Author

qgib commented Apr 15, 2012

Author Name: Giovanni Manghi (@gioman)


  • fixed_version_id was changed from Version 1.8.0 to Version 2.0.0

@qgib
Copy link
Contributor Author

qgib commented Oct 6, 2012

Author Name: Pirmin Kalberer (Pirmin Kalberer)


  • fixed_version_id was changed from Version 2.0.0 to Future Release - Nice to have

@qgib
Copy link
Contributor Author

qgib commented Apr 30, 2017

Author Name: Giovanni Manghi (@gioman)


  • easy_fix was configured as 0

@qgib
Copy link
Contributor Author

qgib commented Feb 13, 2019

Author Name: Nyall Dawson (@nyalldawson)


This was done in 3.4


  • status_id was changed from Feedback to Closed
  • description was changed from The former plugin Raster Calc had the option of selecting a given Data Type (i.e Int16, Float32 etc)
    for the output. This was most useful and is not present in the current Raster Calculator to The former plugin Raster Calc had the option of selecting a given Data Type (i.e Int16, Float32 etc)
    for the output. This was most useful and is not present in the current Raster Calculator
  • resolution was changed from to fixed/implemented

@kannes
Copy link
Contributor

kannes commented Aug 15, 2019

@nyalldawson I can't see this anywhere in 3.8, was there an regression or maybe the merge was forgotten?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request Rasters Related to general raster layer handling (not specific data formats)
Projects
None yet
Development

No branches or pull requests

2 participants