I have made a WFS connection and got a layer from it. I want to use the first feature from that layer.
driver = ogr.GetDriverByName("WFS") wfs_url = "WFS:http://example.com/wfs" wfs = driver.Open(wfs_url) layer = wfs.GetLayerByName("mylayer")
Now I want to use the first feature from it.
>>> print(sessionlayer) None >>> type(sessionlayer) <class 'NoneType'>
layer not give me the first feature?
What is that
If I loop over the features of the layer, I do not get that weird None element:
for i, feature in enumerate(sessionlayer): print(i, feature)
0 <osgeo.ogr.Feature; proxy of <Swig Object of type 'OGRFeatureShadow *' at 0x7f33cca12690> > 1 <osgeo.ogr.Feature; proxy of <Swig Object of type 'OGRFeatureShadow *' at 0x7f33cca126c0> > ... ...
Shouldn't the first printed element be that None again?