5

I'm trying to use gdalwarp to reproject an ascii grid file. According to http://www.gdal.org/formats_list.html this shouldn't be a problem and indeed I can happily use gdal_translate to create grd files (AAIGrid) but not gdalwarp:

gdaltest 14:40:08 $ gdal_translate -of AAIGrid rj_DEM_1978.grd junk.grd
Input file size is 401, 301
0...10...20...30...40...50...60...70...80...90...100 - done.
gdaltest 14:40:25 $ rm junk.*
gdaltest 14:40:41 $ gdalwarp -of AAIGrid rj_DEM_1978.grd junk.grd
Output driver `AAIGrid' not recognised or does not support
direct output file creation.  The following format drivers are configured
and support direct output:
  VRT: Virtual Raster
  GTiff: GeoTIFF
  NITF: National Imagery Transmission Format
  HFA: Erdas Imagine Images (.img)
  ELAS: ELAS
  MEM: In Memory Raster
  FITS: Flexible Image Transport System
  BMP: MS Windows Device Independent Bitmap
  PCIDSK: PCIDSK Database File
  ILWIS: ILWIS Raster Map
  SGI: SGI Image File Format 1.0
  Leveller: Leveller heightfield
  Terragen: Terragen heightfield
  netCDF: Network Common Data Format
  HDF4Image: HDF4 Dataset
  ISIS2: USGS Astrogeology ISIS cube (Version 2)
  ERS: ERMapper .ers Labelled
  RMF: Raster Matrix Format
  RST: Idrisi Raster A.1
  INGR: Intergraph Raster
  GSBG: Golden Software Binary Grid (.grd)
  GS7BG: Golden Software 7 Binary Grid (.grd)
  PNM: Portable Pixmap Format (netpbm)
  ENVI: ENVI .hdr Labelled
  EHdr: ESRI .hdr Labelled
  PAux: PCI .aux Labelled
  MFF: Vexcel MFF Raster
  MFF2: Vexcel MFF2 (HKV) Raster
  BT: VTP .bt (Binary Terrain) 1.3 Format
  LAN: Erdas .LAN/.GIS
  IDA: Image Data and Analysis
  GTX: NOAA Vertical Datum .GTX
  NTv2: NTv2 Datum Grid Shift
  CTable2: CTable2 Datum Grid Shift
  ADRG: ARC Digitized Raster Graphics
  SAGA: SAGA GIS Binary Grid (.sdat)

gdaltest 14:40:52 $ which gdal_translate
/Library/Frameworks/GDAL.framework/Programs/gdal_translate
gdaltest 14:41:05 $ which gdalwarp
/Library/Frameworks/GDAL.framework/Programs/gdalwarp
gdaltest 14:41:10 $ 

As you can see, the format list is somewhat shorter than normal. From the two which commands at the bottom you can also see that both gdalwarpand gdal_translateare located in the same library. Does anyone have an explanation for this? I can work around it easily enough but this shouldn't be happening, should it?

7

gdalwarp has to use Create() not CreateCopy(), and AAIGrid driver doesn't have Create(). Simple solution:

gdaltest 14:40:41 $ gdalwarp -of vrt rj_DEM_1978.grd junk.vrt
gdaltest 14:40:41 $ gdal_translate -of AAIGrid junk.vrt junk.grd
  • The solution you gave is approximately my "workaround". Seems an odd limitation for gdalwarp. – mercergeoinfo Jun 10 '14 at 13:26
  • 2
    It's not gdalwarp, it's the driver for AAIGrid. It's ascii and is written sequentially, so you can't update existing datasets, only copy them. – user10353 Jun 10 '14 at 16:15

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.