quadmesh
quadmesh copied to clipboard
mesh_plot from raw data
Nice example here
https://gis.stackexchange.com/questions/321144/convert-xyz-to-stars-curvilinear-grid-and-plot#321144
f <- '~/Git/stars/elevation_8.0.dat'
temp <- read.table(f)
colnames(temp) <- c('x','y','alt')
library(raster)
#> Loading required package: sp
r <- setExtent(raster(matrix(temp$alt, nrow = 166, byrow = TRUE)), extent(0, 265, 0, 166))
coords <- brick(raster(matrix(temp$x, nrow = 166, byrow = TRUE)), raster(matrix(temp$y, nrow = 166, byrow = TRUE)))
coords <- setExtent(coords, extent(r))
library(quadmesh)
library(ceramic)
mesh_plot(r, coords = coords)
#> Registered S3 methods overwritten by 'ggplot2':
#> method from
#> [.quosures rlang
#> c.quosures rlang
#> print.quosures rlang

im <- cc_location(spex::spex())
#> Warning in spex_to_pt(spx): loc CRS is not set, assuming longlat
#> Warning in project_spex(x, "+proj=merc +a=6378137 +b=6378137"): loc CRS is
#> not set, assuming longlat
plotRGB(im)
mesh_plot(r, coords = coords, add = TRUE, crs = projection(im))
#> coords and crs provided, assuming coords is Longitude, Latitude

Created on 2019-04-29 by the reprex package (v0.2.1)