Learn R Programming

btb (version 0.1.3)

smoothingToGrid: Building of a basemap from smoothed data (Fonction de transformation d'un lissage en un fond de carte carroye)

Description

Transforms smoothed data into grid data for export as cartographical data. (Transforme un lissage en un carroyage pour export cartographique.)

Usage

smoothingToGrid(grid, epsg, cellSize = NULL)

Arguments

grid
the grid obtained from the smoothing (le grid obtenu lors du lissage)
epsg
EPSG code (code EPSG de projection)
cellSize
leave empty (ne pas remplir normalement)

Details

Returns a spatialPolygonsdataframe. (Retourne un spatialPolygonsdataframe.)

Examples

Run this code
## Not run: 
# data(reunion)
# # Smoothing all variables for Reunion (Lissage de toutes les variables pour la Reunion)
# 
# # Call mode 1: classic smoothing - automatic grid
# reunionSmooth <- kernelSmoothing(dfObservations = reunion, cellSize = 200
#                                 , bandwidth = 400)
# 
# # Call mode 2: median smoothing - automatic grid
# reunionSmooth <- kernelSmoothing(dfObservations = reunion, cellSize = 200
#                                 , bandwidth = 400, vQuantiles = c(0.1, 0.5, 0.9))
# 
# # Call mode 3: classic smoothing - user grid
# dfCentroidsUser <- data.frame(x = seq(from = 314508, to = 378708, by = 200)
#                             , y = seq(from = 7634103, to = 7691103, by = 200))
# reunionSmooth <- kernelSmoothing(dfObservations = reunion, cellSize = 200
#                                 , bandwidth = 400, dfCentroids = dfCentroidsUser)
# 
# # Call mode 4: median smoothing - user grid
# reunionSmooth <- kernelSmoothing(dfObservations = reunion, cellSize = 200
#                                 , bandwidth = 400, vQuantiles = c(0.1, 0.5, 0.9)
#                                 , dfCentroids = dfCentroidsUser)
# 
# # Building of the associated basemap (Creation du fond de carte associe)
# grid <- smoothingToGrid(reunionSmooth, "32740")
# 
# # preview (Apercu)
# library(sp)
# library(cartography)
# cartography::choroLayer(grid, var = "houhold", nclass = 5
#                       , method = "fisher-jenks", border = NA)
# 
# # Export of the basemap in shapefile format (Export du fond de carte au format shapefile)
# library(rgdal)
# rgdal::writeOGR(grid, "reunion.shp", "reunion", driver = "ESRI Shapefile")
# ## End(Not run)

Run the code above in your browser using DataLab