I need to export the rgb data in numerical form for each pixel plus the x,y co-ordinates
plus the lat and long data in a txt file. (pls refer to image) Is there an available function which can help me here.
You can do the following:
- Create a subset containing only the three RGB bands.
- Create a mask cover the whole image (expression = ‘true’)
- Open one of the bands (not the RGB)
- Export the mask pixels. Select from the context menu of the image view the item ‘Export Maks Pixels’.
The export takes some time.
Faster, but more steps:
- Create a subset containing only the three RGB bands.
- Add new Bands with Band Math
- band name = latitude; expression = LAT
- band name = longitude; expression = LON
- band name = pixelX; expression = X
- band name = pixelY; expression = Y
- Export as CSV file. Menu: File / Export / CSV
This is how the output will look like (just the first lines):
#sceneRasterWidth=1830
featureId B2:float B3:float B4:float latitude:float longitude:float pixelX:float pixelY:float
0 0.0979 0.0582 0.0409 37.94732 21.000114 0.5 0.5
1 0.105 0.0655 0.0441 37.94732 21.000797 1.5 0.5
The second approach is the one I would suggest. The mask export is to slow. I’ve added this as an issue to our bug tracker (SNAP-932).
1 Like
Thanks Marpet