Skip to content

rgdal writeOGR, KML examples

3 messages · Markus Loecher, Roger Bivand, Barry Rowlingson

1 day later
#
On Sat, 13 Feb 2010, Markus Loecher 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.

Hope this helps,

Roger

  
    
#
On Mon, Feb 15, 2010 at 7:24 AM, Roger Bivand <Roger.Bivand at nhh.no> wrote:

            
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]