Opened 16 years ago

Closed 9 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

Description

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 16 years ago.
example kml styling xsl transform

Download all attachments as: .zip

Change History (4)

comment:1 by warmerdam, 16 years ago

Cc: condit added

comment:2 by condit, 16 years ago

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...

by condit, 16 years ago

Attachment: addStyle.xsl added

example kml styling xsl transform

comment:3 by Even Rouault, 9 years ago

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.