kml_to_csv: KML To CSV Conversion

kml_to_csvR Documentation

KML To CSV Conversion

Description

Function for extracting features (points, lines, polygons) from kml files and writing them to csv files.

Usage

kml_to_csv(filePath, type)

Arguments

filePath

The pathname for the kml file you wish to convert.

type

A character string indicating the type of feature contained in the kml file. Valid arguments are c("points", "lines", and "polygons"). Cannot accomodate files with multiple feature types, so each kml file must contain only a single type.

Details

The function utilizes the readOGR function in the rgdal package to parse the contents of the kml file. The readOGR function requires that the layer name be spefified, which is determined automatically by from the kml file by reading the <name> tag in the first line after the <Folder> tag.

The function cannot convert multiple feature types (i.e., points, lines, polygons) in the same kml file. When exporting the kml from Google Earth, make sure that only one feature type is present for each kml. The function can handle multiple features as long as they are the same type.

kmz files are not supported. Make sure exports from Google earth are saved as kml.

Value

For type = "points": a single csv file for all points

For type = "lines" or "polygons": a single csv for each feature in the kml file

Examples

#TBD


jsta/glatos documentation built on July 11, 2022, 7:01 a.m.