Coordinates tolerance Error

608 views
Skip to first unread message

Gafarou AGOUNDE

unread,
Feb 8, 2021, 11:11:23 AM2/8/21
to Maxent
Hi,
I am facing this error when running this code bellow;

suggested tolerance minimum: 0.662921
Error in points2grid(points, tolerance, round) :
  dimension 1: coordinate intervals are not constant

What does this error mean and how to fix it?
In fact, the Locations.csv file contains just two columns respectively X and Y in decimal degrees (e.g. X=2.07656 Y=7.08511). 
The error occurs when executing the last row.

Here is the code:
ForMapping <- read.csv("Locations.csv")
str(ForMapping)
length(PredictedAbundance) == length(ForMapping$X)
ForMapping$PredictedAbundance <- PredictedAbundance
coordinates(ForMapping) <- ~ X + Y
gridded(ForMapping) <- TRUE

Your help will be very appreciated..........!




Bede-Fazekas Ákos

unread,
Feb 8, 2021, 11:34:22 AM2/8/21
to max...@googlegroups.com
Hello Gafarou,
the error message means that the points stored in Locations.csv are not in a regular grid, i.e., the distances between them are not the same. Although you can increase the tolerance parameter to eliminate the error message, this error usually indicate a deeper problem with the data that can not be solved (just hidden) by the increased tolerance. Maybe the points form a regular grid in another projection, so before trying to cast your SpatialPointsDataFrame to SpatialGridDataFrame with gridded<-(), you should spTransform() it to the adequate CRS. Also you should check whether the data.frame ForMapping contains all the needed X-Y pairs. If the following gives you FALSE, it may indicate the problem:
nrow(ForMapping) == length(unique(ForMapping$X)) * length(unique(ForMapping$X))
I would also give a chance to raster::rasterFromXYZ()
HTH,
Ákos Bede-Fazekas
--
You received this message because you are subscribed to the Google Groups "Maxent" group.
To unsubscribe from this group and stop receiving emails from it, send an email to maxent+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/maxent/f60775c2-079a-4d15-a0de-71c96ee54437n%40googlegroups.com.

Gafarou AGOUNDE

unread,
Feb 13, 2021, 6:33:29 AM2/13/21
to max...@googlegroups.com
Hi Ákos
Thanks for your contribution to my problem. However, l tried to follow your instructions but l can't because I'm not too comfortable with R language.
Could you proposed me anoter simple alternative ?
Best

Management of Wildlife, Protected Areas and Rangeland | MSc, University of Abomey-Calavi, Benin republic. Phone number:(+229)96692934

Reply all
Reply to author
Forward
0 new messages