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

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)))
主站蜘蛛池模板: 定陶县| 房产| 凌海市| 深水埗区| 灵武市| 留坝县| 霍城县| 堆龙德庆县| 双牌县| 建瓯市| 汽车| 陆良县| 望江县| 吴桥县| 无为县| 三江| 连州市| 昌江| 吴江市| 漯河市| 深水埗区| 桐城市| 竹溪县| 白水县| 长海县| 乐陵市| 大荔县| 卢龙县| 湟中县| 南昌市| 如东县| 新民市| 灵璧县| 鸡东县| 上饶市| 枣阳市| 简阳市| 新晃| 剑河县| 湄潭县| 赫章县|