2

I need to use the 19 WorldClim variables in MAXENT, so I have to take the .tif files to .asc files using the translate tool. It's taking forever for me (2% after 2 hours). I've given up. I know its possible, and people use WorldClim for MAXENT, is there a trick I'm missing?

Edit to add: My rasters vary in size from 1 GB to 512 MB. Obviously these are large files, and I expected them to take some time, but maybe not upwards of an entire day. Curiously, when I clipped them to a smaller area of interest, the files came out larger than the untouched version.

  • 2
    ASCII is a very inefficient format for raster data. Please Edit the question to specify the source format, size, depth, and compression. – Vince Aug 25 '17 at 20:48
  • 1
    Have you tried running gdal_translate from the command line? I always find this much quicker. – Ed Rollason Aug 25 '17 at 21:07
  • From my perspective QGIS doesn't add any value for a task like this, you are better to use the GDAL tools directly - QGIS only lightly wraps calls to the command line utilities (gdal_translate as Ed says) and takes away control, you still are going from one file to another in Q. – mdsumner Aug 26 '17 at 1:01
  • 2
    ... and QGIS GUI takes a lot of RAM, that GDAL uses for the tasks. – AndreJ Aug 26 '17 at 7:19
  • This is strange behaviour, I am usually use suggested GDAL command line tool, but GDAL from QGIS worked for me aswell. Do you translating whole data (world) or only part of it (area of interest)? Can you add screenshot or some information about translate settings? – Oto Kaláb Aug 26 '17 at 8:58
0

I have been using the translate tool and sometimes, I don't know why, is too slow. You have two options:

  • If you can have access to a pc with arcgis, try the tool "from raster to ascii" (ArcToolbox/conversion tools/from raster to ascii). It works like a charm.

  • If you have some notions of R (just basics needed) you can try this solution found on researchgate:

    #load library
    library(raster)
    
    #read your file 
    r <- raster(system.file("temp/bio1.grd", package="raster")) 
    
    #export it to asc (ESRI ASCII) 
    writeRaster(r, filename="bio1.asc", format = "ascii", datatype='INT4S', overwrite=TRUE)
    
  • 1
    I ended up using R because I am unfamiliar with gdal, using shell commands, etc. Thank you for your response and provided link. – srn Aug 28 '17 at 17:58
1

As a test to see whether it is faster you can run gdal_translate from the OSGeo4W shell using the instructions here: http://www.gdal.org/gdal_translate.html

Essentially navigate to your directory within the shell and type:

gdal_translate -of AAIGrid  SourceDatasetName.tif OutputDatasetName.asc

This should be much faster than using the translate tool through QGIS. If it is then you can batch the tool using the instructions within this question: How to translate tens of images from a directory as a batch with gdal_translate?

If you don't want asc outputs then you need to change the -of (output format) tag depending on the gdal code (http://www.gdal.org/formats_list.html)

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.