Description Usage Arguments Details Author(s) See Also Examples
Writes object of class "SpatialPolygons*"
to KML with a possibility to parse attribute variables using several aesthetics arguments.
1 2 3 4 5 6 | kml_layer.SpatialPolygons(obj, subfolder.name = paste(class(obj)),
extrude = TRUE, tessellate = FALSE,
outline = TRUE, plot.labpt = FALSE, z.scale = 1,
LabelScale = get("LabelScale", envir = plotKML.opts),
metadata = NULL, html.table = NULL, TimeSpan.begin = "",
TimeSpan.end = "", colorMode = "normal", ...)
|
obj |
object of class |
subfolder.name |
character; optional subfolder name |
extrude |
logical; specifies whether to connect the point to the ground with a line |
tessellate |
logical; specifies whether to connect the LinearRing to the ground |
outline |
logical; specifies whether to outline the polygon |
plot.labpt |
logical; specifies whether to add the label point (polygon centre) |
z.scale |
numeric; exaggeration in vertical dimension |
LabelScale |
numeric; scale factor for size of labels |
metadata |
(optional) specify the metadata object |
html.table |
optional description block (html) for each GPS point (vertices) |
TimeSpan.begin |
(optional) beginning of the referent time period |
TimeSpan.end |
(optional) end of the referent time period |
colorMode |
(optional) KML color mode (normal or random) |
... |
additional style arguments (see |
Label points are be default not plotted. We recommend adding the legend to attribute maps instead. Transparency can be set by using the alpha argument.
TimeSpan.begin
and TimeSpan.end
are optional TimeStamp vectors:
yyyy-mm-ddThh:mm:sszzzzzz
Use the same time values for both TimeSpan.begin
and TimeSpan.end
if the measurements refer to a single moment in time. TimeSpan.begin
and TimeSpan.end
can be either a single value or a vector of values.
Pierre Roudier, Tomislav Hengl and Dylan Beaudette
kml_layer.SpatialLines
, kml_layer.STIDF
, , plotKML-method
1 2 3 4 5 6 7 8 9 10 11 | library(rgdal)
library(sp)
data(eberg_zones)
names(eberg_zones)
## visualize zones using random colors:
kml.file = paste0(tempdir(), "/eberg_zones.kml")
kml(eberg_zones, file.name=kml.file, colorMode = "random")
## with labels:
kml.file2 = paste0(tempdir(), "/eberg_zones2.kml")
kml(eberg_zones, file.name=kml.file2, colour = ZONES,
plot.labpt = TRUE, labels = ZONES, kmz = TRUE, balloon=TRUE)
|
plotKML version 0.6-1 (2020-03-08)
URL: http://plotkml.r-forge.r-project.org/
Loading required package: sp
rgdal: version: 1.5-18, (SVN revision 1082)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 3.0.4, released 2020/01/28
Path to GDAL shared files: /usr/share/gdal
GDAL binary built with GEOS: TRUE
Loaded PROJ runtime: Rel. 6.3.1, February 10th, 2020, [PJ_VERSION: 631]
Path to PROJ shared files: /usr/share/proj
Linking to sp version:1.4-4
To mute warnings of possible GDAL/OSR exportToProj4() degradation,
use options("rgdal_show_exportToProj4_warnings"="none") before loading rgdal.
[1] "ZONES"
KML file opened for writing...
Reprojecting to +proj=longlat +datum=WGS84 +no_defs ...
Writing to KML...
Closing /work/tmp/tmp/RtmpxT7AWq/eberg_zones.kml
Warning messages:
1: In wkt(obj) : CRS object has no comment
2: In spTransform(xSP, CRSobj, ...) :
NULL source CRS comment, falling back to PROJ string
3: In spTransform(xSP, CRSobj, ...) : +init dropped in PROJ string
4: In wkt(obj) : CRS object has no comment
5: In wkt(obj) : CRS object has no comment
6: In showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
Discarded datum Deutsches_Hauptdreiecksnetz in CRS definition,
but +towgs84= values preserved
KML file opened for writing...
Reprojecting to +proj=longlat +datum=WGS84 +no_defs ...
Writing to KML...
Closing /work/tmp/tmp/RtmpxT7AWq/eberg_zones2.kml
sh: 1: /usr/bin/zip: Permission denied
Warning messages:
1: In wkt(obj) : CRS object has no comment
2: In spTransform(xSP, CRSobj, ...) :
NULL source CRS comment, falling back to PROJ string
3: In spTransform(xSP, CRSobj, ...) : +init dropped in PROJ string
4: In wkt(obj) : CRS object has no comment
5: In wkt(obj) : CRS object has no comment
6: In showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
Discarded datum Deutsches_Hauptdreiecksnetz in CRS definition,
but +towgs84= values preserved
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.