Comments (7)
@brandonreavis and @brandonreavis will know more, but I think the bindings to get at this info should be in place. I just updated an example to work with latest master: 417c566
from node-gdal.
Oh, and I'll add that until formal docs are available don't hesistate to look in the c++ code to see what is available: https://github.com/naturalatlas/node-gdal/blob/master/src/gdal_rasterband.cpp#L24-L57. The NODE_SET_PROTOTYPE_METHOD
entries add methods you can call like band.toString()
and the ATTR
entries add properties like band.maximum
.
from node-gdal.
Ah, thats what GDAL's GetColorInterpretation()
function is for (details). I haven't done much with rasters personally, so I only added bindings for the functions that sounded important haha. I haven't touched that method but that should be easy to add. I'll get on that shortly.
Once I add it I think you should be able to do what you want with something like:
console.log("# of bands: "+dataset.bands.count());
dataset.bands.forEach(function(band){
console.log("band["+band.id+"] color: "+band.colorInterpretation);
})
This also reminds me of another thing I have been thinking about... Do we want to convert all GDAL enums into their string names instead of integers? It would be easier to understand when printed out to the console.
from node-gdal.
Also, sorry for the commit that screwed up everything last night hah. I have been trying to keep a crude method/attribute list here, but I havent updated it to reflect last night's change yet. I'll update that today as well.
It can be tricky to understand how to use each function by just glancing at the code sometimes - especially with methods like gdal.open()
which is implemented half in JS and half in C++
from node-gdal.
Awesome @brandonreavis , thanks for the custom addition! And no worries about the commit yesterday, I had no idea.
from node-gdal.
I just updated the list of methods and attributes so its more current and easier to follow. Here it is: (link)
I still need to add the colorInterpretation
attribute.
from node-gdal.
Alright now you should be able to do what you need!
> var gdal = require('./lib/gdal')
undefined
> var ds = gdal.open('examples/sample.tif')
undefined
> var band = ds.bands.get(1)
undefined
> band.colorInterpretation
'Gray'
The list of all the possible strings is here: (link)
from node-gdal.
Related Issues (20)
- polygon intersection with another geometry
- Can't open MVT for write
- gdal.Driver.create's parameter: data_type which need Integer(number) , however , Constants (GDT) : gdal.GDT_* provide string HOT 4
- Using node-gdal in electron HOT 4
- This its under other libs and can't even compile because node-pre-gyp ERROR
- DGN driver
- Node.js 14 HOT 3
- converting
- Node 16 binaries on older OS (glibc version) HOT 3
- npm install not working HOT 2
- Change the AREA_OR_POINT value
- Multi process Read Error HOT 1
- Memory Usage Overflow
- Problem with Node 17
- npm install gdal --save errors on M1 mac HOT 3
- What versions of nodejs are supported?
- Example of resolving GPS lat/long to elevation from a WGS84 TIFF HOT 15
- Get altitude/elevation from GPS coordinates HOT 1
- Add support for node 18
- Is there any release for arm64?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-gdal.