Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201945

Create a kml/kmz file in R with embedded photos

$
0
0

I am using plotKML to generate a kml file with images to overlay inside Google Earth. The following code comes from the help file of spPhoto().

library(plotKML)
#> plotKML version 0.6-0 (2019-11-10)
#> URL: http://plotkml.r-forge.r-project.org/
imagename = "Soil_monolith.jpg"
x1 <- getWikiMedia.ImageInfo(imagename)
sm <- spPhoto(filename = x1$url$url, exif.info = x1$metadata)
kml_open("sm.kml")
#> KML file opened for writing...
kml_layer(sm, method="monolith")
#> Creating Soil_monolith_jpg.dae
kml_close("sm.kml")
#> Closing  sm.kml
kml_compress("sm.kml", files="Soil_monolith_jpg.dae")

It works well, but as we can see the image is located on Wikimedia (online).

x1$url$url
#> [1] "https://upload.wikimedia.org/wikipedia/commons/3/3d/Soil_monolith.jpg"

I was wondering if I could embed the image file into the kml/kmz so I can just pass the file to other people without having to store the image online. Created on 2020-01-27 by the reprex package (v0.3.0)


Viewing all articles
Browse latest Browse all 201945

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>