mirror of
https://gitlab.com/Trygve/contour-creator.git
synced 2024-11-21 23:00:18 +00:00
Tried fixing gdal bullshit in steepnes method
This commit is contained in:
parent
c47565eabb
commit
97c52ecef3
@ -33,6 +33,7 @@ HeightMap::HeightMap(const char* filepath)
|
||||
//https://gdal.org/api/gdaldataset_cpp.html#_CPPv4N11GDALDataset15GetGeoTransformEPd
|
||||
this->geotransform = (double *) CPLMalloc(sizeof(double)*6);
|
||||
this->reference_system = *(file->GetSpatialRef());
|
||||
this->filepath = filepath;
|
||||
|
||||
file->GetGeoTransform(this->geotransform);
|
||||
|
||||
@ -175,11 +176,13 @@ void HeightMap::calculate_steepness()
|
||||
steepness[i] = max - min;
|
||||
}
|
||||
}
|
||||
GDALAllRegister();
|
||||
GDALDataset *original_file = (GDALDataset *) GDALOpen( filepath, GA_ReadOnly );
|
||||
|
||||
const char * filename = "steepness.tif";
|
||||
auto driver = GetGDALDriverManager()->GetDriverByName("GeoRaster");
|
||||
GDALDataset *file;
|
||||
file = driver->Create("steepness.tif", this->width, this->height, 1, GDT_Float32, NULL);
|
||||
GDALRegister_GTiff();
|
||||
file = driver->CreateCopy("steepness.tif", original_file, FALSE, NULL, NULL, NULL);
|
||||
|
||||
file->AddBand(GDT_Float32, NULL);
|
||||
GDALRasterBand *band = file->GetRasterBand(0);
|
||||
@ -188,14 +191,3 @@ void HeightMap::calculate_steepness()
|
||||
0, 0 );
|
||||
GDALClose(file);
|
||||
}
|
||||
|
||||
|
||||
//namespace plt = matplotlibcpp;
|
||||
|
||||
//matplotlibcpp::plot(x, y);
|
||||
//plt::loglog(x, y);
|
||||
/*
|
||||
int main() {
|
||||
|
||||
|
||||
}*/
|
@ -16,8 +16,8 @@ class HeightMap
|
||||
float min; //!< Minimum value in image
|
||||
float max; //!< Maximum value in image
|
||||
OGRSpatialReference reference_system;
|
||||
|
||||
HeightMap(const char* filepath);
|
||||
const char* filepath;
|
||||
float get_pixel(int x,int y);
|
||||
void blur(float standard_deviation);
|
||||
void statistics();
|
||||
|
Loading…
Reference in New Issue
Block a user