On Wed, 13 Jun 2007, Bob Sutherland wrote: > Hi, > > I read in polygon shape file and write the KML for GE using the writeOGR > function > > tmpshpPoly<-readShapePoly("tmpshp",IDvar="AKUCU83_", > proj4string=CRS("+proj=longlat")) > > writeOGR(tmpshpPoly, "test2.kml", "Location","KML") > > In the test2.kml file I'd also like to include a name for each polygon and > some polygon shading. I can edit the shape file and place or edit the tags > but for this to work as we desire, I'd want to write the <name> tag with the > tmpshpPoly$loc field. I'd also like to color the polygon with a > categorization of the tmpshpPoly$nAnimals field. The categorization is > easy. > > I am unable to write the <name> tag within the Placemark tag for each > polygon. I am also unable to alter the > <PolyStyle><fill>0</fill></PolyStyle> fill color to an appropriate color. > If you have suggestions I would be most appreciative. >
The underlying driver is an OGR driver, and can only do as much or as little as OGR permits. If you are on Windows (please _always_ state platform, R and package versions from for example sessionInfo()), and have the latest rgdal, you have GDAL 1.4.1 code, that is the most recent release. http://www.gdal.org/ogr/drv_kml.html says: "OGR has limited support for KML writing" and there is no way to add the information you are interested in. Could I suggest an alternative route, using the maptools functions: GE_SpatialGrid and kmlOverlay, which use the png() graphics device to write an image overlay of whatever you plot - so adding polygon fills, or labels, becomes as simple as plotting? Please see the GE_SpatialGrid help page. Roger > Thank you, > > > > Bob Sutherland > > > [[alternative HTML version deleted]] > > _______________________________________________ > R-sig-Geo mailing list > R-sig-Geo@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: [EMAIL PROTECTED] _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo