R/GIS: How to subset a shapefile by a lat-long bounding box?

后端 未结 3 1702
广开言路
广开言路 2020-12-17 00:10

I want to subset out a shapefile (the .shp and associated files are here) into another one bounded by a set of coordinates, say between longs [80,90] and lats [20,30], and t

3条回答
  •  醉梦人生
    2020-12-17 00:17

    Another way:

    library(raster)
    
    s <- shapefile("/path/asia_rivers.shp")
    
    sub <- crop(s, extent(80, 90, 20, 30))
    
    shapefile(sub, 'cropped_rivers.shp')
    

提交回复
热议问题