[Gdal-dev] how to set OGRFeature names

Brian Hamlin maplabs at light42.com
Thu Oct 11 14:55:01 EDT 2007


Hello Christoph-

   I have been working with the brand new KML driver over the last two 
months, and I am am new to OGR in general. I have found that there are 
limitations mapping from KML to OGR Geometry and back. These 
limitations are not completely final, because the KML driver is still 
evolving, but at this time, not everything works as you might hope. 
(Trac ticket #1858)

See for example, a KML file called soc_map_21.kml, derived from the Map 
of Google's 2007 Summer of Code projects . There are many folders, in 
sub folders, and many placemarks. Each Folder has a Name, and each 
Plaemark has a name and a description. Lets see what happens if we 
convert from KML to KML with ogr2ogr...

ogr2ogr -f KML out.kml soc_map_21.kml
http://ewasteinsights.info/aMiscFiles/kml/soc_map_21.kml

(notice after conversion that quite a bit of the KML detail is now 
gone...)
  ...running the expat example tools, outline and elements, gives some 
insight into the structure before and after. However, it is still hard 
to follow the exact changes (at least with the tools I have). So I pick 
one specific example,

<Folder><name> students</name>
     <Folder><name>AbiSource>
         <Placemark><name> Erik Pukinskis</name><description>..<point>...
         <Placemark><name>Jauco Noordzij</name><description>..<point>...

In the converted file, it looks to me like the output is

<Folder><name>AbiSource
     <Placemark><description><![CDATA[<b>Name:</b>Erik Pukinskis
     <Placemark><description><![CDATA[<b>Name:</b>Jauco Noordzij

big differences... my conclusion is that this mapping is not finalized, 
and not completely tested right now
I think this might be an important use for OGR, and that it needs good 
work to bring it forward to being really useful.
KML handling deserves more documentation, perhaps a  diagram in the 
gdal wiki.     http://trac.osgeo.org/gdal/wiki

all for now
   -Brian


On Oct 11, 2007, at 8:26 AM, Christoph Ehrler wrote:

> Hi @ all,
>
> currently I'm working on an OGR driver for reading <Model> data out of 
> KML files
> using the SAX parser eXpat. I would like to map the internal KML
> structure to OGR by preserving the <Folder> and <Placemark> names.
> Simplified, folders become to layers and placemarks to features (which
> represent the models).
>
> OK, the name of a layer could be set with the constructor of the
> OGRFeatureDefn::OGRFeatureDefn(const char *pszName).
>
> But how can I set the individual name of a feature?
> Are there any conventions about the name and type and index of an
> OGRField that stores this information???
>
>
> Thanks for your help
> Christoph
> _______________________________________________
> Gdal-dev mailing list
> Gdal-dev at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/gdal-dev




More information about the Gdal-dev mailing list