I'm trying to setup a simple python script to query the WFS layers from a 
service. When using the special WFSLayerMetadata layer it seems to get screwed 
up. After the first comma within an abstract is found the field alignment 
becomes broken..

If I look here 
http://trac.osgeo.org/gdal/browser/trunk/gdal/ogr/ogrsf_frmts/wfs/ogrwfsdatasource.cpp#L1221
 it seems the fields are being double quoted before being included into temp 
CSV data

This is the place where the temp mem CSV layer is actually created:
http://trac.osgeo.org/gdal/browser/trunk/gdal/ogr/ogrsf_frmts/wfs/ogrwfsdatasource.cpp#L242

any ideas?

See script below. 

---script---

import ogr
import gdal

wfs_drv = ogr.GetDriverByName('WFS')

gdal.SetConfigOption('OGR_WFS_LOAD_MULTIPLE_LAYER_DEFN', 'NO')

# Note: if you want to use the URL below you need to sign up at
# data.linz.govt.nz and create yourself an API key...
ds = ogr.Open('WFS:http://wfs.data.linz.govt.nz/<my-private-key>/wfs')

layermetadata = ds.GetLayerByName("WFSLayerMetadata")

feat = layermetadata.GetNextFeature()
while feat is not None:
    name = feat.GetFieldAsString('layer_name')
    title = feat.GetFieldAsString('title')
    print( "%s, %s" % (name, title) )
    feat = layermetadata.GetNextFeature()
feat = None

exit(0)

---script---

This message contains information, which is confidential and may be subject to 
legal privilege. If you are not the intended recipient, you must not peruse, 
use, disseminate, distribute or copy this message. If you have received this 
message in error, please notify us immediately (Phone 0800 665 463 or 
[email protected]) and destroy the original message. LINZ accepts no 
responsibility for changes to this email, or for any attachments, after its 
transmission from LINZ. Thank You.
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to