我有一个
SpatialPolygonsDataFrame
我想用它作为
igraph
阴谋。我已经成功地创建了我的
伊格拉
使用
centroids
在
空间多边形数据帧
. 我想转换我的布局坐标,在
matrix
格式,以一种可以在我的底图上绘制的方式。
我正在使用这个代码,但没有得到正确的布局。
long_lat <- SpatialPoints(g_locations, proj4string=CRS("tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +datum=OSGB36 +units=m +no_defs +ellps=airy+towgs84=446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894"))
transformed_locations <- spTransform(long_lat, CRS('+proj=tmerc')) %>%
as.data.frame() %>%
as.matrix()
我的问题是,在进行空间变换时,如何陈述正确的投影?
下面是我的总结
空间多边形数据帧
. 你会看到我用了下面的文字
proj4string :
作为我的
CRC
争论。
地方当局\u shp%>%summary()
Object of class SpatialPolygonsDataFrame
Coordinates:
min max
x 5512.999 655644.8
y 5337.901 1220301.5
Is projected: TRUE
proj4string :
[+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000
+y_0=-100000 +datum=OSGB36 +units=m +no_defs +ellps=airy
+towgs84=446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894]
Data attributes:
objectid lad17cd lad17nm lad17nmw
1 : 1 E06000001: 1 Aberdeen City: 1 Abertawe : 1
10 : 1 E06000002: 1 Aberdeenshire: 1 Blaenau Gwent: 1
100 : 1 E06000003: 1 Adur : 1 Bro Morgannwg: 1
101 : 1 E06000004: 1 Allerdale : 1 Caerdydd : 1
102 : 1 E06000005: 1 Amber Valley : 1 Caerffili : 1
103 : 1 E06000006: 1 Angus : 1 (Other) : 17
(Other):374 (Other) :374 (Other) :374 NA's :358
bng_e bng_n long lat
126473 : 1 268437 : 2 Min. :-6.6572 Min. :49.92
199821 : 1 1006584: 1 1st Qu.:-2.5644 1st Qu.:51.46
200740 : 1 101094 : 1 Median :-1.3868 Median :52.23
212501 : 1 101357 : 1 Mean :-1.4918 Mean :52.61
226544 : 1 104948 : 1 3rd Qu.:-0.2817 3rd Qu.:53.41
227922 : 1 105685 : 1 Max. : 1.6495 Max. :60.50
(Other):374 (Other):373
st_areasha st_lengths local_authority_shp_centroids
Min. :2.904e+06 Min. : 9250 Length:380
1st Qu.:8.626e+07 1st Qu.: 63953 Class :SpatialPoints
Median :2.644e+08 Median : 115284 Mode :S4
Mean :6.054e+08 Mean : 193451
3rd Qu.:6.098e+08 3rd Qu.: 197695
Max. :2.616e+10 Max. :5261282