as.MAPshp: Convert SpatialPolygon objects into MAPshp objects

View source: R/as.MAPshp.R

as.MAPshpR Documentation

Convert SpatialPolygon objects into MAPshp objects

Description

as.MAPshp converts a SpatialPolygon or SpatialPolygonsDataframe object downloaded using getShp into a 'MAPshp object (data.frame) for easy plotting with ggplot.

Usage

as.MAPshp(object)

Arguments

object

SpatialPolygon or SpatialPolygonsDataframe object to convert into a 'MAPshp'.

Value

as.MAPshp returns a MAPshp object (data.frame) containing the below columns.

  1. country_id ISO-3 code of given administrative unit (or the ISO code of parent unit for administrative-level 1 units).

  2. gaul_code GAUL code of given administrative unit.

  3. admn_level administrative level of the given administrative unit - either 0 (national) or 1 (first-level division)

  4. parent_id GAUL code of parent administrative unit of a given polygon (for admin0 polygons, PARENT_ID = 0).

  5. country_level composite country_id_admn_level field.

See Also

autoplot.MAPshp

to download rasters directly from MAP.

Examples

#Download shapefiles for Madagascar and visualise these on a map.

## Not run: 
MDG_shp <- getShp(ISO = "MDG", admin_level = "admin0")
MDG_shp <- as.MAPshp(MDG_shp)
autoplot(MDG_shp)

## End(Not run)


malariaAtlas documentation built on Oct. 27, 2023, 9:07 a.m.