[gdal-dev] OAPIF endpoint and trailing slash

Rahkonen Jukka (MML) jukka.rahkonen at maanmittauslaitos.fi
Mon Dec 16 07:43:37 PST 2019


Hi,

GDAL OAPIF driver, according to the documentation https://gdal.org/drivers/vector/oapif.html, takes the service landing page as URL

"Dataset name syntax
The syntax to open a OGC API - Features datasource is : OAPIF:http://path/to/OAPIF/endpoint
where endpoint is the landing page or a the path to collections/{id}."

In the OGC API Features standard http://docs.opengeospatial.org/is/17-069r3/17-069r3.html#_http_uris the landing page is defined as
"The entry point is a Landing page (path /)"

I read this so that the landing page is "base URL followed by slash" and collections are supposed to locate at "base URL followed by /collections".
The standard seems to say that the landing page must always have a trailing slash and therefore I should use URL like this
ogrinfo OAPIF:https://www.ldproxy.nrw.de/rest/services/kataster/

That request works OK with this server and so does work the next request that ogrinfo generates even if has now two slashes in a row in the middle or the URL
https://www.ldproxy.nrw.de/rest/services/kataster//collections/gebaeudebauwerk/items?limit=10<https://www.ldproxy.nrw.de/rest/services/kataster/collections/gebaeudebauwerk/items?limit=10>

However, with our own server landing page with trailing slash leads to failure because it does not like the double slashes later.
ogrinfo oapif:https://beta-paikkatieto.maanmittauslaitos.fi/geographic-names/wfs3/v1/

generates
https://beta-paikkatieto.maanmittauslaitos.fi/geographic-names/wfs3/v1//collections
and the result is
ERROR 1: HTTP error code : 404 Not Found

I can imagine two alternative ways to fix the issue:

  1.  Document that the URL is the base path and concatenate it with "/" or "/collections" for fetching the landing page or collection reference, respectively.
  2.  Document that landing page must end with slash and make sure that slash will not be duplicated for /collections.
Other suggestions are welcome, including advice to fix our own systems. I have checked many web pages which do not have problems with multiple slashes. Reference to corresponding part of http standard would be appreciated.

I wonder also if I understood right that OAPIF driver does not currently read the landing page at all. However I believe that it is OK that OAPIF server is advertising links which do not use the same base url than the landing page and then the collections would not be found.

Finally I do not understand why using direct URL to a collection work for this server
ogrinfo oapif:https://www.ldproxy.nrw.de/kataster/collections/flurstueck

but not for our server
ogrinfo oapif:https://beta-paikkatieto.maanmittauslaitos.fi/maastotiedot_100k/wfs3/v1/collections/rautatiepiste

The http request looks good but the result is Not Found
HTTP: Fetch(https://beta-paikkatieto.maanmittauslaitos.fi/maastotiedot_100k/wfs3/v1/collections/rautatiepiste)
HTTP: libcurl/7.37.1 OpenSSL/1.0.1h zlib/1.2.3
HTTP: These HTTP headers were set: Accept: application/json
ERROR 1: HTTP error code : 404

-Jukka Rahkonen-



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


More information about the gdal-dev mailing list