[gdal-dev] Scripting OGR and KML

Brian Hamlin maplabs at light42.com
Mon Dec 10 03:38:54 EST 2007


On Dec 9, 2007, at 1:01 PM, Brian Hamlin wrote:
> So the Question is this:
>
>  In OGR terms I see the Layer, Features and Geometry.. A Feature has a 
> FeatureDefinition.
>
>  In KML terms, a Layer is a Folder, and Features are the Placemarks. I 
> can see by conversion testing that a Layer/Folder can have a name , 
> and Feature/Placemark can have a Name and a Description. The 
> description can be quite long.
>
>   But using the class interfaces in a script, I dont see how to set 
> these things.  ???
>
>   It looks like the name in a Feature Definition could be the name of 
> a Placemark. But that leaves Layer - Name, and Feature - Description 
> ??
>

I found that after creating a Layer from a KML datasource and creating 
a feature based on the Layer definition, Feature->SetField() can be 
used to set pre-existing 'Name' ad 'Description' fields.

Reading the documentation and examples regarding FeatureDefn and 
FieldDefn still leaves me puzzled

I put two sample perl scripts on Trac under code snippets
Feedback is welcome
best regards
   -Brian



More information about the gdal-dev mailing list