Maxent to Consnet, making the Cell ID file

96 views
Skip to first unread message

Nayana Wijetilaka

unread,
Jun 3, 2014, 12:00:32 AM6/3/14
to con...@googlegroups.com
Hi everyone !!

Can you please help me to prepare the Cell ID file. I tried using ascii raster conversion using arc gis 10.1 and directly the ascii file to maxcon. No success yet :(

Michael Ciarleglio

unread,
Jun 3, 2014, 11:14:27 AM6/3/14
to con...@googlegroups.com
Hi Nayana,

Where in the process are you stuck?  Are you seeing any error messages?  'maxcon' (which converts Maxent output to ConsNet input) requires three pieces of information:

1) the cell id raster
2) the directory containing Maxent output
3) the location to save the new file

The cell id raster has to be exactly the same dimensions as your maxent data.  Each cell should contain a unique integer id (usually the ID assigned by GIS), and cells which are not included in the study should contain the NODATA value.

(see manual here)

Nayana Wijetilaka

unread,
Jun 3, 2014, 11:42:45 PM6/3/14
to con...@googlegroups.com

Hi Michael,

Hi Michael,

 

Thank you so much for your kind response.

I just want to know how I create the cell id file. I used raster to ascii conversion tool in  Arcgis 10.2 to create Ascii raster.txt file and when I used the raster.txt file in maxcon it says

 

reading in cellID file, C:\Users\HP-PC\Documents\ArcGIS\1\species1.txt

ERROR: File species1.txt contains non-integer value 1.36888E-27

 

The maxent output (Ascii file) having WGS84 and I can’t figure out how I avoid non integer values in .txt

Many thanks again.

 

Regards.

 

Nayana Wijayathilaka

PhD candidate,

Evolutionary Ecology and Systematics Lab,

University of Peradeniya,

Sri Lanka

Michael Ciarleglio

unread,
Jun 5, 2014, 12:38:44 AM6/5/14
to con...@googlegroups.com
Hi Nayana,

I'm not experienced with GIS, but I think this is how we have done it in the past.  If you already have the raster defined in GIS, you can skip step 1.

1) Take an existing raster from your Maxent data set.
2) Use the Raster to Point (or maybe Raster to Polygon) feature in GIS to convert the raster to points (or polygons).
3) GIS will create the features with an associated table.  One of the fields on this table is the unique feature id (FID) assigned by GIS.
4) Use the Feature to Raster tool (or something similar) to convert the data back into an ASCII raster.  When it asks you what field to use for the value of the raster, select the FID field.  This will populate the raster with the unique IDs.

Part of the trick is making sure that the output raster has the same dimensions/cellsize/corner as the input raster.  I think GIS handles that part automatically, but it may take a few tries to get it right. Maxent2ConsNet will definitely catch the error if the rasters are not properly lined up.

When you are done, the beginning of the cell ID text file should look something like this (note the values are integers):

ncols 720 
nrows 300 
xllcorner -180.0 
yllcorner -59.99999217689 
cellsize 0.5 
NODATA_value -9999 
-9999 -9999 -9999 -9999 1 2 3 4 -9999 … 
-9999 -9999 384 385 386 387 … 

Nayana Wijetilaka

unread,
Jun 5, 2014, 5:59:47 AM6/5/14
to con...@googlegroups.com
Thank you Michael, 
Hope I created the cell id file but still have some issues. I couldn't get through the maxcon yet

ERROR: raster dimensions do not match in file: species1.asc [expected 251, 253][found: 3600, 3600]
ERROR: ...close this window to exit the program.

Then I change the cell size (feature to raster option) to the exact size as in the original ascii and the beginning of that raster file shows

ncols         3600
nrows         3574
xllcorner     60.000000000003
yllcorner     0.21666666785501
cellsize      0.008333333333
NODATA_value  -9999

beginning of the original ascii file shows

ncols         3600
nrows         3600
xllcorner     60.00000000000333
yllcorner     -3.33244543071487E-12
cellsize      0.008333333333333333
NODATA_value  -9999

so the no of rows and yllcorner values changed in the converted file. How this happen?

Nayana Wijetilaka

unread,
Jun 16, 2014, 1:08:43 AM6/16/14
to con...@googlegroups.com
Fixed the error by making the processing extent manually in each conversion using arc tools. :) :) 

Ariadna Villa

unread,
Jul 9, 2015, 11:45:06 PM7/9/15
to con...@googlegroups.com

Hi everybody!

I`m having the same problem and i had tried the steps that you say before but i have not got my goal.
Could you tell me what exactly yo did Nayana Wijetilaka, I would apreciate your help!!

Best

Ariadna Villa

unread,
Jul 9, 2015, 11:45:06 PM7/9/15
to con...@googlegroups.com
Hi Nayana Wijetilaka 

I`m having the same problem qith my .asc file and i have tried that you say before but it does not solve my problem, i would apreciate that you can tell me exactly what did you do to fix your problem
Ihope you can help to me

Best!

Ariadna Villa

unread,
Jul 9, 2015, 11:45:06 PM7/9/15
to con...@googlegroups.com


Hi Nayana! 

I´m having the same problem with my CellID: error: cellID must be unique, see cellID 0 
I wonder how did you resolve this problem.

I would like that be possible to help to me.

Best

Michael Ciarleglio

unread,
Jul 10, 2015, 12:34:46 AM7/10/15
to con...@googlegroups.com, ariiad...@gmail.com
Hi Ariadna,

You will see this error "cellID must be unique" when the cell ID file that you provide to MaxentToConsnet does not contain a unique integer for each active cell.  A few things might be going wrong, you should look at your cellID.asc file in a text editor to figure out exactly what is happening.

It is likely that your raster contains some cells that are "masked out" (not part of the analysis).  Those cells should all contain the NODATA_value.  All the other cells are "active." In the cellID file, each one of those should contain a unique integer value.  The error message above means that two or more active cells both have a value of 0.

When you look in the text file, I suspect that you will find a zero listed for every active cell.  Instead of a zero, we want every cell to have a unique integer value.  To create this, we ask GIS to export the FID (feature ID) of each cell as the value in the raster.  This should create a raster that has unique values in every cell.  Ultimately, this makes it a little bit easier to import ConsNet solutions back into GIS for further analysis.

If you are still having trouble, post your cellID file and I can take a closer look.

Cheers!
Michael Ciarleglio

Michael Ciarleglio

unread,
Jul 10, 2015, 12:37:56 AM7/10/15
to con...@googlegroups.com, naya...@gmail.com
Hi Nayana,

I'm glad you found a work around.  I'm not an expert with GIS.  I've had to write a few programs to manipulate those raster files though.  MaxentToConsnet is very picky about raster dimensions because I didn't want to make any mistakes while transforming the data!

mc

Garrick MacDonald

unread,
Feb 12, 2016, 12:16:12 AM2/12/16
to ConsNet, ariiad...@gmail.com
Hi Michael,

I am having the same problem as Ariadna. Every time I try to run maxcon I get "error: cellID must be unique, see cellID 0". Would it be possible for you to look at my files? 

- Garrick

Michael Ciarleglio

unread,
Feb 12, 2016, 12:54:45 AM2/12/16
to ConsNet, ariiad...@gmail.com
Hi Garrick,

Yes, I can take a look.  The most likely cause is that two of the active cells in your raster are assigned a cellID of 0.  Every active cell has to have a unique integer value.

Any cells that you want to mask out of the analysis should contain the NODATA value listed in the header of the ASCII raster file.  If those cells receive a value of 0 instead, that would cause this error (because you will have multiple active cells with a value of 0).

mc
Reply all
Reply to author
Forward
0 new messages