0

To start off with:

Using Gdal/Ogr compiled with Xerces to read a WFS

Reading from a WFS version 1.0.0

Compiler is QT version 5.4.1 ( C++ )

So I'm trying to get all the capabilities of a WFS via code, I'm having trouble with the hidden WFS getRequest called: WFSLayerMetaData. It gives me the elements of what I want, e.g. Title - Name - Abstract. But it will not send me the string's within these elements! I have no idea why, I've been reading the OGR doc's but nothing suggests a way of getting this data.

This is the WFS I'm trying to pull http://demo.mapserver.org/cgi-bin/wfs?SERVICE=WFS&VERSION=1.0.0&request=GetCapabilities&

And I need to get the Spatial Spatial_Operators this WFS has as a string. In addition I need to get the Title, Name and Abstract of this WFS

<Service>
  <Name>MapServer WFS</Name>
  <Title>WMS Demo Server for MapServer</Title>
  <Abstract>
    This demonstration server showcases MapServer (www.mapserver.org) and its OGC support
  </Abstract>
  <OnlineResource>http://demo.mapserver.org/cgi-bin/wfs?</OnlineResource>
</Service>
3
  • What do you get with this ogrinfo wfs:http://demo.opengeo.org/geoserver/wfs WFSLayerMetadata ?
    – user30184
    Commented May 28, 2015 at 9:03
  • So when I call the Base Wfs (demo.opengeo.ogr/geoserver/wfs?[version etc...] in the code I call getLayerByName("WFSLayerMetaData"). Which returns some elements(Variable names). Also the WFSLayerMetaData isnt a offical getRequest its a gdal/ogr thing.
    – Jake Wade
    Commented May 28, 2015 at 9:06
  • Please see the Special Layers section gdal.org/drv_wfs.html
    – Jake Wade
    Commented May 28, 2015 at 9:09

1 Answer 1

1

GDAL in a way has a layer as a base unit and it does not report much about datastore level metadata. Compere with database stores, extents and other metadata are reported for each table separately but not for the whole database. I fear that all you can do is to read the WFS GetCapabilities and parse the service level abstract from there. You can read the capabilities with GDAL from a special layer "WFSGetCapabilities"

ogrinfo WFS:"http://demo.mapserver.org/cgi-bin/wfs?SERVICE=WFS&VERSION=1.0.0" WFSGetCapabilities

At layer lever you can read the abstract of each feature type. However, for this server the strings are empty because abstracts which are not mandatory in WFS are not defined on the server side.

ogrinfo WFS:"http://demo.mapserver.org/cgi-bin/wfs?SERVICE=WFS&VERSION=1.0.0" WFSLayerMetadata
ERROR 1: Server is read-only WFS; no WFS-T feature advertized
Had to open data source read-only.
INFO: Open of `WFS:http://demo.mapserver.org/cgi-bin/wfs?SERVICE=WFS&VERSION=1.0
.0'
      using driver `WFS' successful.

Layer name: WFSLayerMetadata
Geometry: None
Feature Count: 2
Layer SRS WKT:
(unknown)
layer_name: String (0.0)
title: String (0.0)
abstract: String (0.0)
OGRFeature(WFSLayerMetadata):1
  layer_name (String) = continents
  title (String) = World continents
  abstract (String) =

OGRFeature(WFSLayerMetadata):2
  layer_name (String) = cities
  title (String) = World cities
  abstract (String) =
1
  • Thanks man! That's really helpful gives me some more understanding on the subject. I would up-vote your answer but I'm a Gis noob and don't have enough rep to do that ahah.
    – Jake Wade
    Commented May 28, 2015 at 10:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.