CARVIEW |
Select Language
HTTP/2 200
date: Mon, 28 Jul 2025 02:52:40 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
etag: W/"71f66ba2cae9aa65024cf73749ab068a"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=BgnZfwAq62ZCmvEa%2BaKpG5Ycr3U315aVb5Jo9PnFBWfYOjxnEod%2BGbVIwn4wdAquPP4%2Be41uTMLlTBI76mzitQ3qnlcS3vsLAqvNl7tiExfo%2BELmWBJMO8xyMy2Mvn3y%2Bty0USS%2FFfE9NaMbmy0purkcBoOQQuEmONc8XwIu45Zms6h%2FwqynRzy1I2CdLXE5N8W4LFLBH21tlZpm3kNgt5xWJ7VNc5CsQHMe%2F1dDf8sB2yWpK3DtGB2XSRu35U8g%2Bs0DI%2B4k7%2Fyn4n4z%2FEFftg%3D%3D--ocR3WtUJdYwBYN8%2B--EfHsmAt%2F9fhe5YaGdU3XLg%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.1066893741.1753671160; Path=/; Domain=github.com; Expires=Tue, 28 Jul 2026 02:52:40 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Tue, 28 Jul 2026 02:52:40 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: A3B6:246CCF:182E29:256D4E:6886E5F8
How `raster` functions map to `stars` functions · r-spatial/stars Wiki · GitHub
Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 95
How `raster` functions map to `stars` functions
Edzer Pebesma edited this page Oct 16, 2019
·
2 revisions
Here's an attempt at the table describing how raster
functions map to stars
functions, discussed in issue #122. This table uses the functionality of the raster
package as a template; it may be incomplete, imprecise or plain wrong, so take it with a pinch of salt. Any comment or correction is hugely appreciated, please contribute!
Some of the functions (filter
, slice
, mutate
, select
, pull
, ...) are provided via dplyr
, which must be loaded. See ?stars::dplyr
.
? = Not sure / unknown
* = Not present, low priority
# = Not present, high priority
NA = Not available by design
raster | stars | Comment |
---|---|---|
{raster, stack, brick} (read) | read_stars or read_stars(along = ...) | |
{stack, brick} (concatenate layers) | c or c(along = ...) | |
subset | {[ ] , slice, filter} | |
addLayer | c() or c(along = ...) | |
dropLayer | {[ ] , slice, filter} | |
unstack | combine lapply and {[ ] , slice, filter} |
raster | stars | Note/comment |
---|---|---|
merge | c | #, currently only works for adjacent objects |
mosaic | ||
crop | filter, st_crop | |
setExtent | # maybe use st_warp? | |
trim | # | |
aggregate | aggregate | WIP; raster's aggregate with fact=2 will not work, use st_warp in that case? |
disaggregate | # use st_warp(use_gdal = TRUE)? | |
resample | {st_transform, st_warp} | |
projectRaster | {st_transform, st_warp} | |
shift | #, now use st_set_dimensions | |
flip | [] with reversed index | # |
rotate | * | |
t | NA |
raster | stars | Note/comment |
---|---|---|
calc | st_apply | |
overlay | c(along = , ...) %>% st_apply(...) | |
cover | [ ] <- | |
mask | [ ] <- | |
cut | cut | |
subs | ||
reclassify | * forcats::fct_recode ? | |
init | [ ] <- | |
stackApply | {[ ] , slice, filter} %>% st_apply | |
stackSelect |
raster | stars | Note/comment |
---|---|---|
distance | # | |
gridDistance | * | |
distanceFromPoints | # | |
direction | * | |
focal | * | |
localFun | * | |
boundaries | st_as_sf(as_points=FALSE, merge=TRUE, connect8=TRUE) | |
clump | ||
adjacent | * | |
area | st_area | |
terrain | # | |
Moran |
raster | stars | Note/comment |
---|---|---|
predict | predict | |
interpolate | gstat::idw, gstat::krige |
st_warp has raster-raster interpolations of gdalwarp
|
raster | stars | Note/comment |
---|---|---|
rasterize | st_as_stars | |
rasterToPoints | st_as_sf(as_points=TRUE) | |
rasterToPolygons | st_as_sf(as_points=FALSE, ...), st_polygonize | |
rasterToContour | st_contour | |
rasterFromXYZ | ||
rasterFromCells |
raster | stars | Note/comment |
---|---|---|
cellStats | st_apply | |
summary | print, summary(as.vector(. %>% pull)) | |
freq | table | * |
crosstab | ||
unique | unique(as.vector(. %>% pull)) | |
zonal | * |
raster | stars | Note/comment |
---|---|---|
plot | plot, geom_stars | |
plotRGB | plot(x, rgb =...) | |
spplot | - | |
image | image | |
persp | - | |
contour | (st_contour, then sf::plot) | |
filledContour | (same) | |
text | text | |
hist |
hist(x[[1]]) |
|
barplot | ||
density | ||
pairs | ||
boxplot |
raster | stars | Note/comment |
---|---|---|
ncol | dim(x)[1] | or use name instead of 1; cols may be the second dimension! |
nrow | dim(x)[2] | or use name instead of 2; rows may be the first dimension! |
ncell | prod(dim(x)) | |
res | st_dimensions | can also not be a constant in case of rectilinear or curvilinear grids |
nlayers | - | there is no concept of layers in stars |
names | names | |
xres | st_dimensions, look for delta | may not be a constant in case of rectilinear or curvilinear grids |
yres | st_dimensions, look for delta | may not be a constant in case of rectilinear or curvilinear grids |
xmin | st_bbox(x)[1] | |
xmax | st_bbox(x)[3] | |
ymin | st_bbox(x)[2] | |
ymax | st_bbox(x)[4] | |
extent | st_bbox(x) | different ordering of numbers |
origin | - | |
projection | st_crs(x) | |
isLonLat | st_is_longlat(st_crs(x)) | |
filename | stars_proxy objects carry file names where otherwise the array data is | |
bandnr | stars has no general concept of bands | |
nbands | dim(x)[3] | may also be time; bands may also be in another dimension, or have another name |
compareRaster | all.equal(st_dimensions(x), st_dimensions(y)) | * |
NAvalue | - |
raster | stars | Note/comment |
---|---|---|
xFromCol | st_get_dimension_values(., 'x')[col] | I am not sure how to generally get the x dimension name - here it is x |
yFromRow | st_get_dimension_values(., 'y')[row] | I am not sure how to generally get the y dimension name - here it is y |
xFromCell | ||
yFromCell | ||
xyFromCell | ||
colFromX | * | |
rowFromY | * | |
rowColFromCell | NA | |
cellFromXY | NA | |
cellFromRowCol | NA | |
cellsFromExtent | NA | |
coordinates | st_coordinates | |
validCell | NA | |
validCol | col %>% between(st_dimensions(.)$x$from, st_dimensions(.)$x$to) | raster columns are not always named "x" |
validRow | row %>% between(st_dimensions(.)$y$from, st_dimensions(.)$y$to) | raster columns are not always named "y" |
setValues | [ ] <- | |
writeRaster | write_stars | currently uses GDAL, somewhat limited |
KML |
The format of this table follows the raster-package
entry in the raster manual.
Clone this wiki locally
You can’t perform that action at this time.