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

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)))
主站蜘蛛池模板: 北宁市| 平远县| 临澧县| 惠东县| 浠水县| 电白县| 盐池县| 靖宇县| 乐业县| 东乡族自治县| 巴林右旗| 曲周县| 彩票| 玉树县| 芒康县| 额敏县| 印江| 新乡县| 仙游县| 社会| 饶平县| 苗栗县| 老河口市| 霍城县| 中阳县| 义乌市| 洪江市| 华亭县| 临漳县| 辽源市| 缙云县| 抚顺市| 青龙| 兴和县| 菏泽市| 大安市| 高雄县| 青冈县| 白城市| 洞头县| 泰兴市|