我想使用网格(例如meuse.grid(库sp))创建热图。
我有此代码:
# Create a data frame showing the **Latitude/Longitude**
# They are more than 5000 points (these they are only an example)
salidas <- data.frame(
latS = datosPre$latitudS,
longS = datosPre$longitudS,
station = 1:4385
)
# Convert to SpatialPointsDataFrame
coordinates(salidas) <- ~ longS + latS
# Set the projection. They were latitude and longitude, so use WGS84 long-lat projection
proj4string(salidas) <- CRS("+init=epsg:4326")
#Here make a grid, but isnt run like the example.
gridS <- makegrid(salidas, cellsize = 0.01)
gridS <-
SpatialPoints(gridS, proj4string = CRS(proj4string(salidas)))
salidas.grid <- SpatialPixelsDataFrame(salidas)
# View the station location using the mapview function
ms <- mapview(salidas)
ms
我想要这样的东西:
demo(meuse, ask = FALSE, echo = FALSE) # loads the meuse data sets
class(meuse)
mapview(meuse.grid,
zcol = c("soil", "dist"),
legend = TRUE)
谢谢!