2

I am trying to convert a GeoTiff file to ASCII format. After conversion I am getting all pixel values in ASCII file to be NoData value. How can I get the pixel values in ASCII file? Pixel values however are being shown while viewing the raster file in QGIS

Kazuhito
31.4k6 gold badges78 silver badges157 bronze badges
asked Oct 5, 2016 at 14:34
5
  • Please describe how you did the conversion. Gdalinfo from the source image would be useful as well. Commented Oct 5, 2016 at 14:38
  • I used Raster-> Conversion->Translate-> in QGIS. After which a window appeared where I entered the name of output file and pressed OK Commented Oct 6, 2016 at 4:51
  • Tell something about the original GeoTIFF. Commented Oct 6, 2016 at 5:11
  • It was created by taking aerial photos at several locations of an experimental setup and then processed using image processing techniques (DigiCAM) most probably. The thing is that pixel values are appearing while viewing the raster (GeoTIF) file in QGIS but are not appearing in the ascii file. Commented Oct 6, 2016 at 11:32
  • By ascii file, which format do you actually mean? There are different drivers for ASCII gridded XYZ, Arc/Info ASCII grid, Golden Software ASCII grid, and USGS Optional ASCII DEM. What is common for all these is that they support only one band. Your aerial photos are probably color photos, how did the select the band to write into ASCII? Commented Oct 6, 2016 at 12:24

2 Answers 2

1

You could use gdal_translate to convert your GeoTiff to ASCII (XYZ) format. The following example illustrates this point:

gdal_translate -of XYZ dtm_clip.tif dtm_clip.asc

The output will contain a line for each pixel coordinate (x,y) and its associated pixel value (z). E.g.

691614.213629316539 694114.782664827188 166.8800048828125
691615.210331949638 694114.782664827188 166.8800048828125
691616.207034582738 694114.782664827188 166.8800048828125
691617.203737215837 694114.782664827188 166.8800048828125
691618.200439848937 694114.782664827188 166.919998168945312
691619.197142482037 694114.782664827188 166.960006713867188
691620.193845115136 694114.782664827188 166.970001220703125
691621.190547748236 694114.782664827188 166.949996948242188
...
answered Oct 5, 2016 at 15:53
6
  • When I did as you said, all pixel values side of coordinate points are coming with nodata value... Commented Oct 6, 2016 at 4:27
  • Can you print the output from gdalinfo and/or share a sample of the file you are trying to convert? Commented Oct 6, 2016 at 8:16
  • Below is sample of output. The last column is actually nodata value and pixel values are missing Commented Oct 8, 2016 at 3:48
  • 101.742177890832338 113.188780658368486 -32767 101.742909799832333 113.188780658368486 -32767 101.743641708832342 113.188780658368486 -32767 101.744373617832338 113.188780658368486 -32767 101.745105526832333 113.188780658368486 -32767 101.745837435832343 113.188780658368486 -32767 101.746569344832338 113.188780658368486 -32767 101.747301253832333 113.188780658368486 -32767 101.748033162832343 113.188780658368486 -32767 101.748765071832338 113.188780658368486 -32767 101.749496980832333 113.188780658368486 -32767 ....... Commented Oct 8, 2016 at 3:49
  • 101.742177890832338 113.188780658368486 -32767 101.742909799832333 113.188780658368486 -32767 101.743641708832342 113.188780658368486 -32767 101.744373617832338 113.188780658368486 -32767 Commented Oct 8, 2016 at 3:49
0

Using the plugin pointSamplingTool could be a solution
Convert raster to a vector point layer, then export the shape file to ascii.
Link to plugin

answered Oct 5, 2016 at 14:37

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.