[gdal-dev] libkml driver get document name

Even Rouault even.rouault at spatialys.com
Tue Feb 23 15:53:59 PST 2016


Le mardi 23 février 2016 14:50:35, jan vaillant a écrit :
> Hi list,
> 
> I am reading a zipped kml with gdal's libkml driver. I am trying to access
> the name tag of the document:
> 
> <kml>
>   <Document>
>     <name>a_name</name>

I did a quick testing It appears that the driver will report a <name> as the 
layer name only if it inside a <Folder> tag, but not as a direct child of 
<Document>

> ...
> 
> If I look at the source code I can see a way to set those options here for
> writing kml
> 
> void OGRLIBKMLDataSource::SetCommonOptions(ContainerPtr poKmlContainer,
>                                            char** papszOptions)
> {
>     const char* pszName = CSLFetchNameValue(papszOptions, "NAME");
>     if( pszName != NULL )
>         poKmlContainer->set_name(pszName);
> ...
> 
> but I cant find a way to read the options. ogrLayer->GetName() returns the
> file name not the <name>a_name</name> element. Any ideas?
> 
> Thank you
> Jan
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list