An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20100213/e2213564/attachment.pl>
rgdal writeOGR, KML examples
3 messages · Markus Loecher, Roger Bivand, Barry Rowlingson
1 day later
On Sat, 13 Feb 2010, Markus Loecher wrote:
Dear all, I was wondering if anyone has a few more examples on creating KML files with the fantastic writeOGR() function in the rgdal package. The meuse example is great but I am particularly interested in modifying some of the simple style attributes (marker size, type, etc..) in the resulting kml files. Is that possible at all via writeOGR(..., , driver="KML") ?
What is possible in writeOGR() is what is possible in the OGR driver, so please refer to: http://www.gdal.org/ogr/drv_kml.html You will see that there is "little support" for formatting, but as the driver documentation says, try a few simple test files to see what can be done. Alternatives not using this driver are kmlLine() and kmlPolygon() in maptools, which may permit more customising, or the GE_SpatialGrid() and kmlOverlay() tandem in maptools for making an image overlay. This permits arbitrary R symbology, but no querying in GE. Hope this helps, Roger
Thanks ! Markus Loecher [[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: Roger.Bivand at nhh.no
On Mon, Feb 15, 2010 at 7:24 AM, Roger Bivand <Roger.Bivand at nhh.no> wrote:
What is possible in writeOGR() is what is possible in the OGR driver, so please refer to: http://www.gdal.org/ogr/drv_kml.html You will see that there is "little support" for formatting, but as the driver documentation says, try a few simple test files to see what can be done. Alternatives not using this driver are kmlLine() and kmlPolygon() in maptools, which may permit more customising, or the GE_SpatialGrid() and kmlOverlay() tandem in maptools for making an image overlay. This permits arbitrary R symbology, but no querying in GE.
Another possibility when you want total flexibility in your KML output is to roll-your-own conversion, using the 'brew' package. This lets you set up a template with embedded chunks of R code. You'll need to understand the KML file format, of course, but that's quite simple and well documented. You can use the standard KML conversion functions to give you a head start. Do a 'writeOGR' on your data for starters, then edit the KML and spot the bit that recurs for each point or polygon. Put one copy of that section in a loop and save as a brew template. Add salt, pepper, and cook for five minutes. Barry [once again apologies for sending this with the wrong 'From:' address first time]