Guest User

Untitled

a guest
Jan 15th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. library(raster)
  2. library(sf)
  3.  
  4. # Bay area data: long_min = -123.0056, long_max = -121.99944, lat_min = 36.99944, lat_max = 38.00056
  5. sf_bay_data = raster::raster("data/goldengate/n38w123/imgn38w123_13.img")
  6.  
  7. # Create Simple Feature Geometry (sfg) Polygon around GG Bridge
  8. gg_sfg <- st_polygon(list(cbind(c(-122.56, -122.56, -122.41, -122.41, -122.56), c(37.88, 37.77, 37.77, 37.88, 37.88))))
  9.  
  10. # Add projection info by creating an sfc object
  11. gg_sfc <- st_sfc(gg_sfg, crs = "+init=epsg:4326")
  12.  
  13. # Create simple feature dataframe
  14. gg_sf <- st_sf(gg_sfc)
  15.  
  16. # Crop SF Bay data to zoom in around GG Bridge
  17. gg_data <- raster::crop(sf_bay_data, gg_sf)
Add Comment
Please, Sign In to add comment