kml_to_csv: KML To CSV Conversion

View source: R/util-kml_to_csv.r

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 = c("points", "lines", "polygons"))

Arguments

filePath

The pathname for the kml file you wish to convert.

type

Optional character string indicating the type(s) of feature(s) to read from the kml file. Valid values are ⁠c("points", "lines", and "polygons")⁠.

Details

kmz files are not supported. Make sure exports from Google earth are saved as kml. Or extract (unzip) kml from kmz.

Value

A csv file (same name as input filePath but with csv extension) is written to directory containing input filePath with five columns

name

Feature name

feature_type

Feature type

seq

Sequential position in feature

longitude

Longitude

latitude

Latitude

altitude

Altitude

Examples


# Get example kml with two polygons
kml_file <- system.file("extdata", "example_polygons.kml",
  package = "glatos"
)

kml_to_csv(kml_file)


ocean-tracking-network/glatos documentation built on April 17, 2025, 10:38 p.m.