v.out.ogr input=labels layer=1 dsn=/home/paulo/test.kml format=KML
will export the vector layer ‘labels’ as the kml file test.kml
When you do this, you may find that the Name and Description fields in the resulting kml file are empty. In that case you probably do not have columns with those names in the attribute table of your vector layer. The v.out.ogr function looks for these columns in your input layer. If doesn’t find it, it leaves the corresponding columns in the kml file empty.
A possible solution would be to rename the two columns you want to use to Name and Description respectively. There is a better solution though. The v.out.ogr function offers an additional parameter, dsco, to define OGR dataset creation options. You can use this to map the columns that should be used for the Name and Description fields.
v.out.ogr input=labels layer=1 dsn=/home/paulo/test.kml format=KML dsco='NameField=PNVname,DescriptionField=PNVcode'
You can also use the GUI (menu: file | export vector map | common export formats). Go to the field ‘OGR dataset options’ under the tab ‘Creation’
Of course, this is all described in the help file for v.out.ogr (but I have to admit I overlooked it initially), which is a good starting place if you want more details.
See my next post how to do the same in QGIS. As noted in that post, ogr2ogr, the underlying OGR function used by v.out.ogr, exports the attribute table of the input vector layer as Extended data in the output kml file. In the linked post, I give a method to remove the extended data that v.out.ogr exports