Created
August 8, 2015 14:22
-
-
Save pepijn-devries/39a0746bca93e02d6949 to your computer and use it in GitHub Desktop.
ContourLines to SpatialPolygons
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #create bounding box to which the final polygons needs to be clipped: | |
| CP <- as(extent(0 + 2/ncol(volcano2), 1 - 2/ncol(volcano2), 0 + 2/nrow(volcano2), 1 - 2/nrow(volcano2)), "SpatialPolygons") | |
| #clip polygons and plot: | |
| final_volcano <- gIntersection(poly_volcano, CP, byid=TRUE) | |
| png("volcano04.png", 200, 200) | |
| par(oma = c(0,0,0,0), mar = c(0,0,0,0)) | |
| plot(final_volcano, col = terrain.colors(length(poly_volcano)), border = NA) | |
| dev.off() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment