Leaflet 将sf对象转换为光栅

Leaflet 将sf对象转换为光栅,leaflet,sf,r-leaflet,Leaflet,Sf,R Leaflet,基本上,我正在尝试将一个sf对象转换为一个光栅文件,用传单打印。 sf对象如下所示: Simple feature collection with 33901 features and 1 field geometry type: POINT dimension: XY bbox: xmin: 63.42624931 ymin: -18.21972306 xmax: 175.2237467 ymax: 58.60000076 geographic CRS: WGS

基本上,我正在尝试将一个
sf
对象转换为一个光栅文件,用传单打印。 sf对象如下所示:

Simple feature collection with 33901 features and 1 field
geometry type:  POINT
dimension:      XY
bbox:           xmin: 63.42624931 ymin: -18.21972306 xmax: 175.2237467 ymax: 58.60000076
geographic CRS: WGS 84
First 10 features:
     df$prhmax                       geometry
1  24.46245324 POINT (77.57315415 -17.2288...
2  24.48866948 POINT (77.97969243 -17.1712...
3  24.51029786 POINT (78.38618742 -17.1142...
4  24.51992770 POINT (78.79264389 -17.0577...
5  24.52394288 POINT (79.199056 -17.00185241)
6  24.53245239 POINT (79.60542849 -16.9464...
7  24.56160049 POINT (80.01176604 -16.8915...
8  24.60146712 POINT (80.41806278 -16.8372...
9  24.62994385 POINT (80.82432335 -16.783531)
10 24.65465755 POINT (81.23055239 -16.7303...

我一直在努力解决这个问题。如果我只是打印(sf.object),效果很好,但我无法制作光栅。

生成一个光栅层并将点光栅化到它

# Load packages
packs <- list("tidyverse", "raster", "sf")
lapply(packs, require, character.only = T)

# Convert points to sp (assumes that the sf object is called example_points)
example_points <- as(example_points, "Spatial")

# Generate empty raster layer and rasterize points
example_raster <- raster(crs = crs(example_points), vals = 0, resolution = c(0.5, 0.5), ext = extent(c(-180, 180, -90, 90))) %>%
   rasterize(example_points, .)
#加载包

您可以使用的包?光栅::光栅化(或仅显示点?)谢谢!我错过了rasteirze的功能部分。