Opened 12 years ago

Closed 5 years ago

#2298 closed enhancement (fixed)

improve the OGR KML creation options

Reported by: timmie Owned by: condit
Priority: normal Milestone:
Component: OGR_SF Version: unspecified
Severity: normal Keywords: whis enhancement kml
Cc: condit


Hello, when converting to a KML file from a vector resource via the virtual file format one can give a NameField? option which will be used to assigne names to the geoobjects on the KML file: ogr2ogr -f KML output.kml input.shp -dsco NameField?=RegionName?

Please add another option for placemark categories like ogr2ogr -f KML output.kml input.shp -dsco PlacemarkCategory?=kind_of_site

This option/keyword could serve the purpose to create a KML file and assign different Icons for the placemarks based upon unique identifiers in the database column "kind_of_site".

Example: A ecologist who wants to map sitings of three animal species could use the categoriy to show which bird appeard where (e.g. coocoo, eagle, crow) and display this information using different icons.

Please comment if you have a better idea who to get categorized items for KML based upon vector database information.

Thanks for looking at this.

Attachments (1)

addStyle.xsl (3.6 KB) - added by condit 12 years ago.
example kml styling xsl transform

Download all attachments as: .zip

Change History (4)

comment:1 Changed 12 years ago by warmerdam

Cc: condit added

comment:2 Changed 12 years ago by condit

Owner: changed from warmerdam to condit
Status: newassigned
Type: defectenhancement

I think this is a bit out of the scope of the KML driver - simply because we'll end up writing creation options for every possible KML style parameter / geometry type. As an alternative, I'm attaching an example XSL script that I wrote. Once the KML is generated by OGR, use the scripts (after adjusting for your own data nuances) to style the KML file. In this example the XSL styles polygons based on an attribute. This will change when the KML 2.2 driver becomes production because you can do this more precisely with the new schema fields, but this should serve as a good starting point. Let me know if you have any questions and if this helps resolve this issue...

Changed 12 years ago by condit

Attachment: addStyle.xsl added

example kml styling xsl transform

comment:3 Changed 5 years ago by Even Rouault

Resolution: fixed
Status: assignedclosed

The LIBKML driver has received plenty of creation options in GDAL 1.11 to make use of almost all KML features, so closing this

Note: See TracTickets for help on using tickets.