R using fortify to project shapefile on google map gives wrong results

المشرف العام

Administrator
طاقم الإدارة
I have a shapefile that looks like this

> str(FieldsMap)Formal class 'SpatialPolygonsDataFrame' [package "sp"] with 5 slots ..@ data :'data.frame': 3 obs. of 2 variables: .. ..$ id : int [1:3] 3 2 1 .. ..$ Attr: Factor w/ 3 levels "A","B","C": 3 2 1 ..@ polygons :List of 3 .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots .. .. .. ..@ Polygons :List of 1 .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots .. .. .. .. .. .. ..@ labpt : num [1:2] 8.6 47.7 .. .. .. .. .. .. ..@ area : num 5.88e-08 .. .. .. .. .. .. ..@ hole : logi FALSE .. .. .. .. .. .. ..@ ringDir: int 1 .. .. .. .. .. .. ..@ coords : num [1:6, 1:2] 8.6 8.61 8.61 8.61 8.6 ... .. .. .. ..@ plotOrder: int 1 .. .. .. ..@ labpt : num [1:2] 8.6 47.7 .. .. .. ..@ ID : chr "0" .. .. .. ..@ area : num 5.88e-08 .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots .. .. .. ..@ Polygons :List of 1 .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots .. .. .. .. .. .. ..@ labpt : num [1:2] 8.61 47.68 .. .. .. .. .. .. ..@ area : num 1.41e-06 .. .. .. .. .. .. ..@ hole : logi FALSE .. .. .. .. .. .. ..@ ringDir: int 1 .. .. .. .. .. .. ..@ coords : num [1:15, 1:2] 8.61 8.61 8.61 8.61 8.61 ... .. .. .. ..@ plotOrder: int 1 .. .. .. ..@ labpt : num [1:2] 8.61 47.68 .. .. .. ..@ ID : chr "1" .. .. .. ..@ area : num 1.41e-06 .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots .. .. .. ..@ Polygons :List of 1 .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots .. .. .. .. .. .. ..@ labpt : num [1:2] 8.61 47.68 .. .. .. .. .. .. ..@ area : num 1.11e-06 .. .. .. .. .. .. ..@ hole : logi FALSE .. .. .. .. .. .. ..@ ringDir: int 1 .. .. .. .. .. .. ..@ coords : num [1:17, 1:2] 8.61 8.61 8.61 8.61 8.61 ... .. .. .. ..@ plotOrder: int 1 .. .. .. ..@ labpt : num [1:2] 8.61 47.68 .. .. .. ..@ ID : chr "2" .. .. .. ..@ area : num 1.11e-06 ..@ plotOrder : int [1:3] 2 3 1 ..@ bbox : num [1:2, 1:2] 8.6 47.68 8.61 47.68 .. ..- attr(*, "dimnames")=List of 2 .. .. ..$ : chr [1:2] "x" "y" .. .. ..$ : chr [1:2] "min" "max" ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slot .. .. ..@ projargs: chr "+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"No I want to plot the polygons with ggmap on a google map so I run:

MapExtent
 
أعلى