kml_to_csv | R Documentation |
Function for extracting features (points, lines, polygons) from kml files and writing them to csv files.
kml_to_csv(filePath, type)
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. |
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.
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
#TBD
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.