2

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.

lovalery
  • 4,524
  • 3
  • 14
  • 28
  • I experience the same error. If I add a positive value large enough to ensure that all values on the variable plottet were themselves positive, then the error disappeared. Unfortunately this is no fix at least not in my case. – Jesper Hybel Pedersen Oct 20 '20 at 12:57
  • 1
    Thanks for sharing this, Jesper. I will try to make use of your suggestion. I have read that this package has become forgotten somehow. (no one is updating or maintaining it anymore). I will post again here when I come across a solution. – ibrahim shaheen Oct 21 '20 at 14:51

0 Answers0