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[[1]])
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">
      <overlayXY x="0" y="1" xunits="fraction" yunits="fraction"/>
      <screenXY x="0" y="1" xunits="fraction" yunits="fraction"/>

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).

  • Note that I have been able to load the KML into the old version of Google Earth app. Path issues and mime association remain elusive. – Flip Jul 15 '17 at 21:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.