Maxent error: Error projecting, two layers have different geographic dimensions

4,076 views
Skip to first unread message

nima...@hotmail.com

unread,
Jul 7, 2015, 4:53:45 AM7/7/15
to max...@googlegroups.com
Hello Maxent community, 

I successfully ran maxent for the present-climate distributions. When I was projecting it using future climates, I got an error message: 

Error projecting: java.io.IOException: Files bio6 and alt in directory D:\\WorldClim\Future\ACCESS1_0\rcp4 have different geographic dimensions. 

I went to ArcMap, reloaded all my layers and set both of them to have the same dimensions for one of the layers that did not pose a problem (bio1). That said, when I prepared my layers, I always used the exact same shapefile to "extract by mask", so it's odd that I would have this problem in the first place. They all have the same projection as well. 

Despite correcting the layers to have the same dimensions (I did this by right-clicking on the layer, "properties" -> "extent" -> and then choosing the layer that didn't pose a problem), maxent still gives me an error message for the same two layers. 

Any suggestions on how I could correct this please? 

Thanks!

Nima

Jordan M

unread,
Jul 9, 2015, 11:32:59 AM7/9/15
to max...@googlegroups.com
Open the ASCII files in a text editor to make sure the number of rows and columns are the same, as well as cell size.... I struggled with this recently and found it easier to change all of those properties prior to converting to ASCII (I think I did it during the clip stage, actually) by setting the extent and cell size to match bio01 using the 'Environments...' option.

I forget my exact step-by-step process I did but I have it written down somewhere. 

adcha...@gmail.com

unread,
Jul 14, 2015, 11:58:22 PM7/14/15
to max...@googlegroups.com
Hi Nima,

You can open the first file in Notepad++ and copy the header, paste the header for remaining files. I have done this and worked fine. I did it when I had very small difference in the header file.

HOpe helps...

changi

unread,
Dec 27, 2017, 8:32:24 AM12/27/17
to Maxent
Oh,Thanks ,You are right,You are amazing,I copy the header than paste the header for remaining files,I have succeeded.

Ra Zoo

unread,
Jan 30, 2019, 8:16:41 AM1/30/19
to Maxent
if change the header, the ASCII files move from the real boundary and it appears just line line..... do have any solutions?


On Wednesday, July 15, 2015 at 11:58:22 AM UTC+8, adcha...@gmail.com wrote:

Dinka Zewudie

unread,
Nov 16, 2019, 1:23:46 PM11/16/19
to Maxent
Dear Changi,

I have same problem with the nima please help me with the guide. thank you so much.

MaxentNoob

unread,
Nov 17, 2019, 7:55:19 AM11/17/19
to Maxent
Messing up the file header is NOT a solution but a dirty hack. You can use gdaltools, e.g. the very flexible warp command, or the raster package in R, particularly the resample or projectRaster functions.

Michael Bungard

unread,
Nov 17, 2019, 12:45:19 PM11/17/19
to Maxent
Jordan M is quite right, changing the header does work but not if your original files don't have the same rows and columns. Depending on your version of Arcgis there are some important extras to tick to keep the rasters to the same cell size and therefore produce the same number of rows and columns.

Unfortunately I am not in front of my computer right now and can't remember the exact parts to tick, so I will try and repost tomorrow morning.

MaxentNoob

unread,
Nov 18, 2019, 11:58:07 AM11/18/19
to Maxent
The problem of using hacks as the one proposed is that they DO WORK WHENEVER THE PRODUCT OF THE X AND Y DIMENSIONS IS THE SAME. This, however, DOES NOT in any way suggest that the fabricated raster correctly represents any data. Manipulating the header section providing the origin of an actually correct raster is conceptually as absurd as injecting e.g. road network data from somewhere else into an existing map. Using this approach, instead of creating another correct raster (this time also with the right extent), one could even make maps of the central park in NY that show the summit of the Kilimandjaro without an error message in maxent. This is only acceptable if the actual offset is minimal and imho only for exploratory work but not for publication. Just do it right in the first place.

anders...@gmail.com

unread,
Apr 7, 2021, 4:53:44 PM4/7/21
to Maxent
would you elaborate on how to do it right the first time?

Rainer

unread,
Apr 9, 2021, 2:39:33 AM4/9/21
to Maxent
Sure, I would generally recommend to use the raster package in R.

if R1 and R2 are two rasters that differ slighly in some aspects such as extent and/or coordinate reference system and/or NoData cells just use

R2 <- projectRaster(R2, R1)
R2 <- mask(R2, R1)
R1 <- mask(R1, R2)

if the CRS is identical u will get a warning suggesting you to use 'resample' instead which you can ignore.
(Make sure to set the method parameter to "ngb" and think before using this for categorical data ever)

You can also use the equivalent packages and functions in python or any GIS such as QGIS.
[Again, modifying the header is effectively manipulation and should be avoided!]
Good luck!!

Cheers,
Reply all
Reply to author
Forward
0 new messages