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?
Answer
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.
Cause:
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:
Solution:
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
Note:
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
No comments:
Post a Comment