Shapefile - problem with number of points in LinearRing

المشرف العام

Administrator
طاقم الإدارة
I am new to shapefiles and I've got a bit lost. I am trying to plot pooling sections in my region (Madrid) with different colors.

But I get

Error: IllegalArgumentException: Invalid number of points in LinearRing found 3 - must be 0 or >= 4when using the fortify function on my data (please, find the full code below). I found in this form that it may have to do with the rgeos library, but my rgeos version is

rgeos version: 0.3-8, (SVN revision 460)GEOS runtime version: 3.4.2-CAPI-1.8.2 r3921 Polygon checking: TRUE which is new, since I have installed it right now.

Someboty explained me that the problem is that my data has a point or a line section, not a full polygon, which requires 4 points. I went to QGIS, open the file and checked the geometry validity. I found the following errors

3969,segment 0 of ring 0 of polygon 1 intersects segment 0 of ring 8 of polygon 2 at -3.53569120482, 40.42586446423969,segment 0 of ring 221 of polygon 1 intersects segment 0 of ring 8 of polygon 2 at -3.53569120482, 40.42586446423969,Geometry has 2 errors.4166,ring 1 with less than four points4166,Geometry has 1 errors.so that I elliminated polygon 1 and checked again the geometry validity of the new data set, but I get the same errors.

Can anybody provide me with a hint to fix this problem?

library(sp)library(maptools)library(rgdal)library(ggmap)library(ggplot2)library(rgeos)library(plyr)seccionesOk
 
أعلى