[R-sig-Geo] rgdal writeOGR, KML examples

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Mon Feb 15 09:03:05 CET 2010


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]

-- 
blog: http://geospaced.blogspot.com/
web: http://www.maths.lancs.ac.uk/~rowlings
web: http://www.rowlingson.com/
twitter: http://twitter.com/geospacedman
pics: http://www.flickr.com/photos/spacedman



More information about the R-sig-Geo mailing list