Please try:


library(rgdal)
dsn <- system.file("vectors", package = "rgdal")[1]
cities <- readOGR(dsn=dsn, layer="cities")
names(cities)
writeOGR(cities, "cities.kml", "cities", driver="KML")
names(cities) <- paste("var", 1:4, sep="")
names(cities)
writeOGR(cities, "cities1.kml", "cities", driver="KML", dataset_options="NameField=var1")

OK?

Roger

---
Roger Bivand, NHH, Helleveien 30, N-5045 Bergen,
Roger.Bivand@nhh.no



-----Original Message-----
From: Noli Sicad [mailto:nsicad@gmail.com]
Sent: Sat 02.01.2010 03:14
To: Roger Bivand
Cc: sig-geo
Subject: How to implement Org2Org "-dcso NameField=..." in rgdal, writeOGR() KML
 
Hi,

I would like to minic this Org2Ogr command (below) to write shapefile
to KML. How do I do this in rgdal,  " -dcso NameField=Name_2"

Org2Ogr command:
~~~~~~~~~
Org2Org -f KML NZL_3.kml NZL_adm3.shp -dcso NameField=Name_2

~~~~~~~~~

Rgdal

~~~~~~~~~~
library(rgdal)

mymap<-readOGR("NZL_adm3.shp", layer="NZL_adm3")

writeOGR(mymap,"NZL_3.kml", driver="KML", layer="NZL_adm3", "something
should be here")

~~~~~~~~~~

Thanks in advance.

Noli


	[[alternative HTML version deleted]]

