| Spatial2map | R Documentation |
These functions transform some classes provided by the packages sp and sf into a simple list that can be used by map().
SpatialPolygons2map(database, namefield=NULL)
SpatialLines2map(database, namefield=NULL)
sf2map(database, namefield="name")
database |
A |
namefield |
The name of a data column in |
The 'map' list object only preserves co-ordinates and polygon names. All other information available in the original data is lost. For instance, plotting order for enclaves may be wrong, resulting in invisible polygons when setting fill=TRUE.
The option namefield is only taken into account if database is class Spatial[]DataFrame. namefield may be a vector of column names, e.g. to get polygons named as 'country:state'.
A list with four components: x, y, names, range, similar to the return value of map(). This data can be used as a database for map(). The lines and polygons are separated by NA.
map,SpatialPolygons (in the sp library).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.