I want to extract the values of all the pixels within my study area and their coordinates, what is the best way to do this?
I read the help and the topics related to this question, but I couldn’t export properly
Thanks to the SNAP team for their quick and continuous response.
Did you read this,
Use pins to export pixel values, Source of the post
With regards to coordinates you could export each pin coordinate as well,
Yes I read. I have about 1000 pixels. You mean to pin each pixel and extract the values and coordinates of them? Isn’t this a bit time consuming?
you can also digitize a polygon and then right-click > export transect pixels > write to file
This gives you a table with pixel coordinates and values, line by line
If you have a subset of your area, you could export the whole image as CSV: File/Export/CSV.
You will have a text file with all the information of every pixel in your image in table format.
Thanks. I checked this, I have about 1000 pixels but here it shows me 124 pixels
and its output file is not very usable
Thanks, I exported CSV, but output file haven’t any coordinate and pixel pixel value
Have you selected “Write to file“?
If so, could you please share the txt file in here?
Now I understand. I suggested “Export Transect Pixels” which only exports the pixels along the polygone line.
To have the full area, “Export Mask Pixels” is required. This is inactive until you save the product (after digitizing the polygon)
File > Save Product
Thanks for your attention. Solved.
I was trying to expert backscatter coefficient and incident angle from my study area scene using this method but “Export Mask Pixels” option is marked as grey that i am unable to select that, even after saving the product. Please help me to export my pixel values as .CSV file.
It should help if you close and reopen the image view, where you have drawn the shape.
I have added a ticket to our bug tracker for this: [SNAP-1352] Mask not shown in product view after creation
Thank you marpet, I did try the method, and it works and the file format is .txt, but I need the pixel values in .CSV format. So is there any option there to extract pixel values with my desired file format?
You can simply exchange the file ending. CSV is just a special type of a text file. The content is tab separated.
Alternatively you can go to the menu at
File / Export / CSV. In the file dialog you click on the subset button and select the are you want. Then save the file to disk. This will be a bit different format. But it is also CSV and it has this file ending.
For details of this format, please have a look at the help:
This is what i got, while extract the .csv file using File / Export / CSV option.
. I am not getting the attributes.
When you export as CSV your NaN values will appear as blanks. I am not able to see in your screenshot if you have values later on the file (you have more than 3000 rows). A fast solution would be to convert you .txt into .csv in Excel. In any case, both formats can be tab separated, if that is what you need.
can you please upload the CSV here?
its showing the file is too big to upload here. My file is approximately 400 MB.
you can make a copy and only use the first 100 lines, for example.