[R-sig-Geo] Coordinates tolerance ERROR
Bede-Fazekas Ákos
b|@|ev||@t @end|ng |rom gm@||@com
Wed Feb 10 15:00:42 CET 2021
Hello Gafarou,
(as I answered your question previously in maxent using googlegroups.com...)
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 indicates 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().
Please send us a reproducible example (e.g. the original Locations.csv)
to let us reproduce the error and understand its reason.
HTH,
Ákos Bede-Fazekas
2021.02.10. 14:38 keltezéssel, Gafarou AGOUNDE írta:
> 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..........!
>
> Sent from Mail for Windows 10
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
More information about the R-sig-Geo
mailing list