I converted a shp file into asc file in QGIS. Then I tried running the Maxent with that enviromental layer and came across that error message:

java.lang.NumberFormatException: For input string:“Z^,,,”

Can anyone help me?

  • one of your number fields has a Z in it - open the file with a text editor and look for the problem. – Ian Turton Jun 22 '17 at 7:54
  • How did you export the raster file? I suggest that this Maxent error is caused because your raster is actually GeoTIFF with .asc extension. Run gdalinfo from comamnd line or in QGIS'Information... from processing toolbox. Check the Driver: value. – Oto Kaláb Jun 22 '17 at 8:37

This error is caused because your raster is actually GeoTIFF file with .asc extension, which is unsupported by MaxEnt.

You can check this in raster metadata (or by running gdalinfo from comamnd line, or in QGIS Information... from processing toolbox). Check the Driver: value.

enter image description here


You converted your .shp with Raster -> Conversion -> Rasterize (Vector to Raster)... which runs gdal_rasterize and create GeoTIFF (default output) even if you choose other format. In this case a warrning message should appear:

enter image description here


You can fix your raster file with Raster -> Conversion -> Translate (Convert Format)... (which runs gdal_translate). As output format choose Arc/Info ASCII Grid.

Notice the -of AAIGrid argument in the gdal_translate command preview:

gdal_translate -of AAIGrid /source/path/source.asc /output/path/fixedascraster.asc


I think (according to GDAL documentation gdal_rasterize), editing gdal_rasterize command with addition -of AAIGrid argument should also work , but this gives me unsupported format error for some reason, but you can give it try.

edit: clarification of note:

According to GDAL documentation gdal_rasterize, you can edit gdal_rasterize command with addition -of argument, and define output type. But in this case it doesn't work for AIIGrid.

Running gdal_rasterize -of AIIGrid.. from command line leads to error which tells you that AAIGrid does not support direct output creation

ERROR 6: Output driver `AAIGrid' not recognised or does not support direct output file creation.

Checking this with gdalinfo --formats gives you:

AAIGrid -raster- (rwv): Arc/Info ASCII Grid

Acording to this message from gdal-dev mailing list the capabilities are:

r: rear

w: write "Create dataset by copying another"

v: supports virtual IO - eg. /vsimem/

Which means that is still supported for translating with gdal_translate

  • I followed your instructions and was able to run Maxent, thank you. But now i have a different problem regarding the colours of the model map. – Idoia Jun 23 '17 at 15:52
  • @Idoia You're welcome :). If you don't find any question post with suitable answer, don't hesitate to create new one. – Oto Kaláb Jun 23 '17 at 17:47

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.