Creates *.kml files of a subset of polygons from a polygon shapefile

Description

Subset polygons acording to the matches between a vector and a specified column from a SpatialPolygonsDataFrame.

Usage

1
MapkmlPSU(shape = NULL, psu = NULL, id = NULL, path = ".")

Arguments

shape

string with the name of a polygon shapefile or an object of class SpatialPolygonsDataFrame (see examples).

psu

the values to be matched.

id

column of the *.dbf file with the values to be matched against.

path

string indicating the path to the folder containing the shapfile. If the shapefile is in the working directory or if shape argument is a shapefile, path can be ignored.

Details

If there are *.kml files in the working directory, the new created files will overwrite it in case of name matching.

shape must receive a shapefile with appropriate coordinate reference system, otherwise, MapkmlPSU report an error.

Value

*.kml files of the subsetted polygons.

References

http://oswaldosantos.github.io/capm

See Also

readShapeSpatial

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# Load data with the polygon identifiers. 
data(psu.ssu)

# Take a sample of 10 PSU with probability 
# proportional to size with replacement.
(selected.psu <- SamplePPS(psu.ssu, 10, write = FALSE))

## Define shape from shapefile.
shp.path <- system.file('extdata', package="capm")
# The code above used a shapefile avaliable in the
# capm package.
# You might want to write a code like:
# shp.path  <- 'path_to_the_folder_with_the_shapefile'

# Create *kml files of 10 polygons.
# Uncomment the following line to create kml files:
# MapkmlPSU('santos', selected.psu[, 1], 1, shp.path)

## Define the shape argument as an object x of class SpatialPolygonsDataFrame.
# MapkmlPSU(x, selected.psu[, 1], 1)