Skip to content

Instantly share code, notes, and snippets.

@edzer
Created October 21, 2017 09:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edzer/381dac079ddcd5174be31209675b3822 to your computer and use it in GitHub Desktop.
Save edzer/381dac079ddcd5174be31209675b3822 to your computer and use it in GitHub Desktop.
stars -> sf for affine raster
library(stars)
library(sf)
geomatrix = system.file("tif/geomatrix.tif", package = "stars")
x = st_stars(geomatrix)
st_dimensions(x)
## from to offset delta geotransform
## x 1 20 1841002 1.5 1841000, 1.5, -5, 1144000, -5, -1.5
## y 1 20 1144003 -1.5 1841000, 1.5, -5, 1144000, -5, -1.5
## refsys point values
## x +proj=utm +zone=11 +datum=WGS84 +units=m +no_defs TRUE NULL
## y +proj=utm +zone=11 +datum=WGS84 +units=m +no_defs TRUE NULL
library(sf)
## Linking to GEOS 3.5.1, GDAL 2.1.2, proj.4 4.9.3, lwgeom 2.3.1 r15264
s = st_as_sf(x, as_points = FALSE)
plot(s, axes =TRUE)
@edzer
Copy link
Author

edzer commented Oct 21, 2017

affine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment