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

  • Please describe how you did the conversion. Gdalinfo from the source image would be useful as well. – user30184 Oct 5 '16 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 – user83835 Oct 6 '16 at 4:51
  • Tell something about the original GeoTIFF. – user30184 Oct 6 '16 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. – user83835 Oct 6 '16 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? – user30184 Oct 6 '16 at 12:24
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
...
  • When I did as you said, all pixel values side of coordinate points are coming with nodata value... – user83835 Oct 6 '16 at 4:27
  • Can you print the output from gdalinfo and/or share a sample of the file you are trying to convert? – dmci Oct 6 '16 at 8:16
  • Below is sample of output. The last column is actually nodata value and pixel values are missing – user83835 Oct 8 '16 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 ....... – user83835 Oct 8 '16 at 3:49
  • 101.742177890832338 113.188780658368486 -32767 101.742909799832333 113.188780658368486 -32767 101.743641708832342 113.188780658368486 -32767 101.744373617832338 113.188780658368486 -32767 – user83835 Oct 8 '16 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.