#6761 closed defect (invalid)
GDALDEMProcessing : wrong slope processing
Reported by: | TremblayGIS | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | GDAL_Raster | Version: | 2.1.2 |
Severity: | normal | Keywords: | DEM SLOPE RASTER GDALDEMProcessing |
Cc: |
Description
Hello, at first i wish you all a very happy new year.
Here is my issue : when i create slope with the GDALDEMProcessing i got a wrong result. It looks like a binarised file with only 2 values. The strange part is that if i replace "slope" with "aspect" or "hillshade" it works very well.
The result is the same if i change the extension : *.tif, *.dt1 etc...
here is the fonction (so basic...) :
void gdalfile::createSlope() {
GDALDatasetH hDataset; GDALAllRegister(); hDataset = GDALOpen( "D:/datas/n41.dt1", GA_ReadOnly );
GDALDatasetH hOutDS = GDALDEMProcessing("D:/datas/n41_slope.tif", hDataset,"slope",NULL,NULL,NULL);
}
then in the main i call the function like this gdalTest.createSlope();
Do you have any idea ?
Regards
Attachments (1)
Change History (8)
by , 7 years ago
Attachment: | gdalSLOPE.pdf added |
---|
comment:1 by , 7 years ago
comment:2 by , 7 years ago
Hello, thank you for your return. So instead of NULL i need to set a GDALDEMProcessingOptions, could you give me an example of how using it. I saw i have to deal with GDALDEMProcessingOptionsNew() and GDALDEMProcessingOptionsFree() but i do not know how to do it. it looks that i need to use something like this : GDALDEMProcessingOptions* GDALDEMProcessingOptionsNew (char papszArgv, GDALDEMProcessingOptionsForBinary * psOptionsForBinary ) but i can not see how to deal with that. If you have some example that would be great :)
thanks in advance
comment:3 by , 7 years ago
And by the here is what i can get with gdal info :
Projection is `GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]]' Origin = (0.999583,42.000417) Pixel Size = (0.000833,-0.000833)
regards
comment:4 by , 7 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
The API is documented there http://gdal.org/gdal__utils_8h.html
More specifically: http://gdal.org/gdal__utils_8h.html#ac6e67c9ca37448286a6031e626e551ae
I'm going to close this ticket, as it seems more an issue of using the code that in the code itself. The gdal-dev mailing list or other media are better for questions.
comment:5 by , 7 years ago
Hello, i'm trying to step forward with the information you gave to me
here i set the option list, with just the scale option
char papszArgv;
papszArgv = (char)"-s 111120";
....
here is the call GDALDatasetH hOutDS = GDALDEMProcessing("D:/donneesSIG/n41_slope.tif", hDataset,"slope",NULL,GDALDEMProcessingOptionsNew (papszArgv,NULL),NULL); }
i got a 255 error and n41_slope.tif is created. Could you please help me ? regards
comment:6 by , 7 years ago
The arguments must be separated and the array NULL terminated.
char* papszArgv[] = { "-s", "111120", NULL };
comment:7 by , 7 years ago
Thanks it works even if i got a warning : "ISO C++ forbids converting a string constant to 'char*'" regards
Presumably you need to specify the the -s scale parameter