[gdal-dev] Parse GML without geometry

Steve.Toutant at inspq.qc.ca Steve.Toutant at inspq.qc.ca
Fri Dec 12 12:38:06 PST 2014


thanks Kyle

I ended up with 
geom=osgeo.ogr.CreateGeometryFromGML(wfs_response)
Returns ERROR 1: Unrecognised geometry type <FeatureCollection>

If I understand well, I think my question now is
How do I parse the feature collection with ogr?







Kyle Shannon <kyle at pobox.com> 
2014-12-12 14:47

A
Steve.Toutant at inspq.qc.ca
cc
GDAL Developers <gdal-dev at lists.osgeo.org>
Objet
Re: [gdal-dev] Parse GML without geometry








Steve,

On Fri, Dec 12, 2014 at 12:35 PM,  <Steve.Toutant at inspq.qc.ca> wrote:
> Hi,
> I need to parse the GML returned by this query, to make a list of unique
> value of NA2DESC tag using python
> 
http://demo.mapserver.org/cgi-bin/wfs?SERVICE=WFS&REQUEST=GetFeature&version=1.1.0&Typename=continents&maxfeatures=10&propertyname=(NA2DESC)

>
> I could not make it with a XML parser yet. I consider using ogr API but 
can
> I use it even if there is no geometry?

This one has a geometry, or so ogr thinks so:

kyle at kyle-workstation:~$ ogrinfo -so -al -ro
"/vsicurl_streaming/http://demo.mapserver.org/cgi-bin/wfs?SERVICE=WFS&REQUEST=GetFeature&version=1.1.0&Typename=continents&maxfeatures=10&propertyname=(NA2DESC)"
INFO: Open of 
`/vsicurl_streaming/http://demo.mapserver.org/cgi-bin/wfs?SERVICE=WFS&REQUEST=GetFeature&version=1.1.0&Typename=continents&maxfeatures=10&propertyname=(NA2DESC)'
      using driver `GML' successful.

Layer name: continents
Geometry: Unknown (any)
Feature Count: 10
Extent: (-90.000000, -180.000000) - (83.627419, 180.000000)
Layer SRS WKT:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0,
        AUTHORITY["EPSG","8901"]],
    UNIT["degree",0.0174532925199433,
        AUTHORITY["EPSG","9122"]],
    AUTHORITY["EPSG","4326"]]
Geometry Column = msGeometry
gml_id: String (0.0)
NA2DESC: String (0.0)
NA3DESC: String (0.0)

>
> If ogr api is a good option, any link to examples or tutorial would be
> appreciated since I never used the API.

API tutorials:

For gdal 2.x:

http://gdal.org/ogr_apitut.html

For gdal 1.x (the vector side is ogr):

http://gdal.org/1.11/ogr/ogr_apitut.html

>
> Thanks!
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

kss

-- 
Kyle



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20141212/d76dccd3/attachment.html>


More information about the gdal-dev mailing list