dovboringen.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:pydov 作者: DOV-Vlaanderen 项目源码 文件源码
def parse_wfs(response, layer, version):
        """A generator to parse the response from a wfs, depending on the
        server version

        Parameters
        ----------
        response : StringIO
            The response from a wfs.getfeature() query (OWSlib)
        layer : str
            The wfs layer that is queried
        version : str
            The version of the WFS server: only '1.1.0' and '2.0.0'

        """
        if version == "1.1.0":
            # convert layer preposition to null
            layer = 'null:' + layer.split(':')[1]
            # convert the response to a dictionary
            doc = xmltodict.parse(response)
            # yield the layers of the dict
            for a in doc['wfs:FeatureCollection']['gml:featureMembers']:
                yield (a[layer])
        elif version == "2.0.0":
            # convert the response to a dictionary
            doc = xmltodict.parse(response.read())
            # yield the layers of the dict
            for a in doc['wfs:FeatureCollection']['wfs:member']:
                yield (a[layer])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号