Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an ascii text file containing location data (column 9-lat and 10-long) and intensity(column 20)

  200010  207  020311    40658.5  406593 52 344927.31 7100203.50  -26.2078720  127.4491855 345060.64 7100369.14   26.4  650.3  628.0 55471.293    20.168 55648.817 55637.523  -146.062

the text file has many lines 10k+

I am trying to export this ascii text into a GeoTIFF using GDAL, but not sure how to proceed.


share|improve this question
up vote 7 down vote accepted

With GDAL, you would need to create a VRT file. This needs to be done by hand for what you want, but it's not difficult and is explained here. But for completeness, this is what you need to do:

Using a text editor, copy this snippet into it and save it as whatever.vrt The fields should be self explanitory, but note that without column headings in the CSV file (that is the source ASCII file you have) the fields you use must be "field_n" where n=1 is the first column.

    <OGRVRTLayer name="test">
        <GeometryField encoding="PointFromColumns" x="field_10" y="field_9" z="field_20"/>

The next step is to run gdal_grid which will interpolate between points if you ask it to. The minimum you need on the command line is:

gdal_grid -ot Float32 -l test test.vrt test.tif

Where -l is the name of the layer as specified in the OGRVRTLayer tag in the VRT. There are many options you can add to gdal_grid to get the results you want, so look here for them all, as well as some extra stuff about VRT files.

If you're not confident with the command line, the latest QGIS provides the gdal_grid function as an option in the Raster menu, but the building of the VRT part has to be done by hand because the QGIS one only deals with rasters.

share|improve this answer
As a corollary, if you want to visualise more than one value, you will need to create separate GeoTIFFs for each band because gdal_grid assumes your value is the "z" parameter of your VRT. Then you will have to create a VRT file either by hand or use gdalbuildvrt with the -separate option. Post a new question if you want help with this. – MerseyViking May 1 '11 at 14:47
many thanks for this, will try soon. – portoalet May 1 '11 at 14:57

GDAL doesn't have it's own viewer as far as I know. But there are many GIS using GDAL, for example QGIS.

How about using QGIS Delimited Text Layer plugin? It will load every line as a point with all columns as attributes. You will want to add a header to the text file before you import it.

share|improve this answer
oops, i was unclear, wanted to export the textfiles into a GeoTIFF so it can be viewed in other app. – portoalet May 1 '11 at 14:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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