Pregunta

How can I solve a netlogo error like

Extension exception: invalid cell size on line 5

When I try to load an AsciiGrid (.asc) raster with :

set slope gis:load-dataset "data_carto/DTMBanyulsEPSG2154/small_slope.asc"

I have find the github extention code (line 88) but I don't realy understand how it work

thank's

MAJ :

The header of my asc file :

ncols        346
nrows        270
xllcorner    3.087906007412
yllcorner    42.451833343014
dx           0.000106344549
dy           0.000106459930
 0 27.467638015747070312 31.712091445922851562 35.38886260986328125 36.1437835693359375 36.798412322998046875 36.798412322998046875 36.37$
 0 26.552234649658203125 31.561212539672851562 35.23743438720703125 35.762996673583984375 35.20586395263671875 35.20586395263671875 34.34$
 0 27.206226348876953125 29.196367263793945312 30.581308364868164062 29.855892181396484375 29.219537734985351562 29.219537734985351562 29$

There is somthing wrong ?

¿Fue útil?

Solución 2

Finaly I have find where my error come from ... :-) @Eric Russell was of course right!

my error come from the gdal transformation of my tif file to asc file... After the 1.9 version (I believe) we need to add a special option in the gdal_translate commande ! -co FORCE_CELLSIZE=TRUE. with :

gdal_translate -of "AAIGrid" -b 1 -co FORCE_CELLSIZE=TRUE DTMBanyulsEPSG2154/small_slope.tif DTMBanyulsEPSG2154/small_slope.asc

It work and the header is :

ncols        321
nrows        250
xllcorner    3.087906007412
yllcorner    42.451920815321
cellsize     0.000114626835

Otros consejos

The GIS extension is expecting line 5 of your .asc file to start with "CELLSIZE" (the value of the CELL_SIZE constant here), in either upper or lower case. If line 5 doesn't start with that value, the extension reports an error as you're seeing. If your .asc file doesn't have cellsize on line 5, you may need to re-arrange the lines of the .asc file.

I had a similar problem while rasterizing a shapefile. It was solved by reprojecting the rasterized file (.asc) to my target SRC in QGIS. I hope this helps ;)

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top