naturalatlas / node-gdal

Node.js bindings for GDAL (Geospatial Data Abstraction Library)
http://naturalatlas.github.io/node-gdal/classes/gdal.html
Apache License 2.0
567 stars 124 forks source link

gdal.Driver.create's parameter: data_type which need Integer(number) , however , Constants (GDT) : gdal.GDT_* provide string #280

Closed c101088 closed 3 years ago

c101088 commented 3 years ago

I can find the cpp src file gdal.h reference in http://nagyak.eastron.hu/doc/gdal-1.6.2/docs/docs-64/gdal_8h.html , in which , enum GDALDataType show the integer . Could it be useful?

brandonreavis commented 3 years ago

On the javascript side the string form of each constant is used, but the binding automatically translates the strings back to integers before calling the native gdal method.

See https://github.com/naturalatlas/node-gdal/blob/master/src/gdal_driver.cpp#L272 for reference.

c101088 commented 3 years ago

emmm.... actually , here's my question. When i use the create function in typescript , i could not assign a vaule for the _datatype parameter by using gdal.GDT_* .

c101088 commented 3 years ago

here is my code :

const tempDataSet:gdal.Dataset = gdal.drivers.get("GTiff").create("temp//"+destFileName+".tif", width,height,this.band,gdal.GDT_Float32);