官术网_书友最值得收藏!

Changing projection system

To change projection, we can use spTransform() from the rgdal package. We can do so using a CRS() argument inside spTransform():

map_bd = spTransform(map_bd, CRS("+proj=longlat +datum=WGS84"))

The preceding code sets the projection system to the longitude and latitude and the GCS to WGS84. If we want to change the projection to any other layer's (shapefile's) projection inside CRS(), we can write proj4string() to get the CRS of a new layer and then set it to that. For example, if we want to set the projection system of a layer a to the projection system of layer b, we can do so simply by writing the following: 

a = spTransform(a, CRS(proj4string(b)))
主站蜘蛛池模板: 大渡口区| 丹巴县| 临颍县| 府谷县| 浮梁县| 疏勒县| 百色市| 黔江区| 金塔县| 沭阳县| 景泰县| 福清市| 临湘市| 珲春市| 中山市| 顺昌县| 涞水县| 中方县| 双流县| 内乡县| 泽普县| 江川县| 太谷县| 朔州市| 海南省| 霍林郭勒市| 六枝特区| 西林县| 固安县| 板桥市| 乐平市| 舞阳县| 陵川县| 洞头县| 镇安县| 炉霍县| 河池市| 陇川县| 洛浦县| 崇文区| 盱眙县|