2

I am trying to obtain elevation readings using gdallocationinfo (as per other datasets I have) from a set of .asc files containing elevation data (plus an associated .prj file), using WGS84, but I can't seem to find a way to do this in a way that uses the correct projection.

gdal_merge.py -o ../osTerrain50.tiff *.asc

gives me a GeoTIFF.

Opening this in QGIS shows that the data appears correctly, but it does ask me for the projection, so I specify EPSG:27700 (which is OSGB36).

Indeed gdalinfo does show that the .tiff file doesn't end up containing the projection:

> gdalinfo osTerrain50.tiff

Driver: GTiff/GeoTIFF
Files: osTerrain50.tiff
Size is 13200, 24600
Coordinate System is `'
Origin = (0.000000000000000,1230000.000000000000000)
Pixel Size = (50.000000000000000,-50.000000000000000)
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (       0.000, 1230000.000) 
Lower Left  (   0.0000000,   0.0000000) 
Upper Right (  660000.000, 1230000.000) 
Lower Right (  660000.000,       0.000) 
Center      (  330000.000,  615000.000) 
Band 1 Block=13200x1 Type=Float32, ColorInterp=Gray

What do I need to do reproject this to WGS84, into some format (TIFF/shp/whatever) that gdallocationinfo can read?

NB I need to do this via the command-line, not via GUI programs.

2
  • I think you need to merge the reproject using gdal_transform
    – Ian Turton
    Jan 15, 2016 at 20:42
  • Or create a VRT and reproject that and then convert to a tiff
    – Ian Turton
    Jan 15, 2016 at 20:42

1 Answer 1

2

If QGIS asks you for a CRS, it does not write that information into the file. You have to save the data into a new file, then QGIS writes the CRS information into it.

Alternatively, use gdal_translate -a_srs to assign the CRS to the output file.

If you need a different projection, use gdalwarp -s_srs -t_srs to do both things in one step.

2
  • Thanks; that worked: gdal_translate -a_srs "EPSG:27700" osTerrain50.tiff osTerrain50_osgb36.tiff
    – fooquency
    Jan 16, 2016 at 18:04
  • And the second worked: gdalwarp -s_srs "EPSG:27700" -t_srs "EPSG:4326" osTerrain50.tiff osTerrain50_wgs84.tiff
    – fooquency
    Jan 16, 2016 at 18:04

Your Answer

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

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