On Jun 7, 2010, at 2:23 PM, Hans-Jörg Bibiko wrote: > On Jun 7, 2010, at 1:36 PM, Heuvelink, Gerard wrote: > I used 'Add polygon' in Google Earth to create a (single) closed polygon. It > was saved with extension kmz. >> >> How can I open such a file in R, such that I can for instance do an overlay >> with raster maps (SpatialGridDataFrame)? > > Here only my first thoughts: > kmz files are nothing else then zipped kml files. You can save your polygon > in Google Earth by choosing "kml" as format, or unzip your kmz file and > rename it to *.kml, or read the kmz as zip connection in R and process the > data coming from that connection.
Here a tiny R example: library(maptools) getKMLcoordinates(textConnection(system("unzip -p /Users/foo/test.kmz", intern = TRUE))) --Hans _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo