kml_polygons: Read Polygons out of a KML file.

Description Usage Arguments Value Note References Examples

Description

Read Polygons out of a KML file.

Usage

1
kml_polygons(x, ns = "d1", verbose = TRUE, fuse = FALSE, ...)

Arguments

x

A KML source. See kml_read.

ns

The name of the namespace to extract from: defaults to "d1".

verbose

Whether to report invalid coordinates and/or altitudes below sea level; defaults to TRUE. See kml_coords.

fuse

Whether to fuse multi-polygons into a single element; defaults to FALSE. Experimental. Might not return nice things.

...

Arguments passed to read_xml. See kml_read.

Value

A tibble containing the folder (layer), name, description, styleUrl and geographic coordinates (longitude, latitude and altitude) of the first Polygon contained within each Placemark element of the KML source. Other Placemark elements will be ignored.

If there are no Polygons in the KML source, the function returns NULL. If there are no Folders in the KML source, the folder variable will be filled with NA.

Note

The function only extracts the outer bounds of Polygon elements, and it only extracts the first Polygon out of each Placemark element. As a result, multi-polygons built into <MultiGeometry> elements are not fully supported: only the first Polygon will be present in the results.

References

Google Developers. KML Reference: <Polygon> Element. https://developers.google.com/kml/documentation/kmlreference#polygon

Examples

1
2
3
4
# demo data: U.S. Civil War map
# see ?states for details
f <- system.file("extdata", "states.kml.zip", package = "tidykml")
kml_polygons(f)

briatte/tidykml documentation built on May 13, 2019, 7:43 a.m.