Maps in R using Cartogram function

392 Views Asked by At

I am struggling with an error that returns after applying cartogram_cont() function

Here is the code and the error

carto3 <- cartogram_cont(map33, "resi_eur_avg", itermax=5)

The error message appears after the first iteration as:

Mean size error for iteration 1: -2.73958727096137 Error in CPL_geos_op("buffer", x, dist, nQ, numeric(0), logical(0)) : Evaluation error: IllegalArgumentException: Points of LinearRing do not form a closed linestring. In addition: Warning message: In sqrt(desired/pi) : NaNs produced

The map is a PROJECTED map for EU regions. I have applied the same code above for a similar map with a different variable instead of resi_eur_avg, everything went well.

I have used st_is_valid(map33) to try to spot something, however (all rows get the value TRUE). Even with Max iteration = 1, the error persists

I am wondering what does this error message mean? and how to solve it?

Thanks in advance.

0

There are 0 best solutions below