I'm using emissions data in the form of netCDF files from the CMIP5 project. I've loaded this data into R as a rasterBrick and can see that it has 6 layers. My goal is to be able to use this data with Google Earth maps.
My understanding is that plotKML does this. However, I've had a difficult time getting this to work smoothly. After contorting paths, I had some success:
> plotKML(bdat[]) Plotting the first variable on the list KML file opened for writing... Writing to KML... Closing bdat__1__.kml
This produced a file:
<kml xmlns:xsd="http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd" xmlns:xmlns="http://www.opengis.net/kml/2.2/" version="1.0"> <Document> <name>bdat__1__</name> <open>1</open> <Folder> <name>SpatialGridDataFrame</name> <GroundOverlay> <name>colour</name> <altitude>0</altitude> <altitudeMode>clampToGround</altitudeMode> <Icon> <href>X54786.png</href> </Icon> <LatLonBox> <north>90</north> <south>-90</south> <east>180</east> <west>-180</west> </LatLonBox> </GroundOverlay> </Folder> <ScreenOverlay> <name>Legend</name> <Icon> <href>X54786_legend.png</href> </Icon> <overlayXY x="0" y="1" xunits="fraction" yunits="fraction"/> <screenXY x="0" y="1" xunits="fraction" yunits="fraction"/> </ScreenOverlay> </Document>
But I cannot load this into Google Earth properly. Frankly, I'm not sure if the KML file is wrong or if my workflow is wrong. What I do know is that if I run the model scripts, R writes a file to the cwd and then looks for it elsewhere:
> plotKML(eberg["CLYMHT_A"]) Plotting the first variable on the list KML file opened for writing... Reprojecting to +proj=longlat +datum=WGS84 ... Writing to KML... Closing eberg__CLYMHT_A__.kml The file /Users/flip/Google Drive/2017.summer/CMIP5/RCP_data/Bulk/R26_spatial/Drive/2017.summer/CMIP5/RCP_data/Bulk/R26_spatial/eberg__CLYMHT_A__.kml does not exist.
Moreover, on my Mac, this bring sup filehelper in the Google folder (I created because it seems to need one) and doesn't know that the KML file should be ahndled by Google Earth (possibly because that'd a chrome app now).