View source: R/sp_from_data_frame.R
sp_from_data_frame | R Documentation |
Function to promoting a data frame to a SpatialPointsDataFrame, SpatialLinesDataFrame, or SpatialPolygonsDataFrame.
sp_from_data_frame( df, type, latitude = "latitude", longitude = "longitude", projection = projection_wgs84(), keep = FALSE, id = NA )
df |
Data frame to be converted into spatial data frame. |
type |
Type of geomerty. Type must be one of |
latitude |
|
longitude |
|
projection |
|
keep |
For when type is |
id |
Variable in |
A SpatialPointsDataFrame, SpatialLinesDataFrame, or SpatialPolygonsDataFrame.
Stuart K. Grange
## Not run: # Promote to different geometry types # Points sp_points <- sp_from_data_frame(data_drawn, type = "points") # Lines sp_lines <- sp_from_data_frame(data_drawn, type = "lines") # Lines with seperate geometries sp_lines <- sp_from_data_frame(data_drawn, type = "lines", id = "name") # Polygons sp_polygons <- sp_from_data_frame(data_drawn, type = "polygons") # Polygons with seperate geometries sp_polygons <- sp_from_data_frame(data_drawn, type = "polygons", id = "name") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.