[mapserver-commits] [MapServer/MapServer] 0db046: OGC API Proof-of-Concept (#6180)

Steve Lime noreply at github.com
Fri Jul 2 06:19:16 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/MapServer/MapServer
  Commit: 0db046cafcb9fce757e1fc652cdd467dfd9b5c28
      https://github.com/MapServer/MapServer/commit/0db046cafcb9fce757e1fc652cdd467dfd9b5c28
  Author: Steve Lime <steve.lime at state.mn.us>
  Date:   2021-07-02 (Fri, 02 Jul 2021)

  Changed paths:
    M .github/workflows/start.sh
    M CMakeLists.txt
    M Makefile
    M cgiutil.c
    M cgiutil.h
    M maperror.c
    M maperror.h
    M mapfile.c
    A mapogcapi.cpp
    A mapogcapi.h
    M mapows.c
    M mapserv.c
    M mapserv.h
    M mapserver-config.h.in
    M mapserver.h
    M mapservutil.c
    M mapstring.cpp
    M maptemplate.h
    A msautotest/api/data/mn_counties.dbf
    A msautotest/api/data/mn_counties.prj
    A msautotest/api/data/mn_counties.shp
    A msautotest/api/data/mn_counties.shx
    A msautotest/api/data/mn_major_rivers.dbf
    A msautotest/api/data/mn_major_rivers.prj
    A msautotest/api/data/mn_major_rivers.shp
    A msautotest/api/data/mn_major_rivers.shx
    A msautotest/api/data/mn_population_centers.dbf
    A msautotest/api/data/mn_population_centers.prj
    A msautotest/api/data/mn_population_centers.shp
    A msautotest/api/data/mn_population_centers.shx
    A msautotest/api/expected/conformance.json
    A msautotest/api/expected/ogcapi_api.json
    A msautotest/api/expected/ogcapi_collections.json
    A msautotest/api/expected/ogcapi_collections_mn_counties.json
    A msautotest/api/expected/ogcapi_collections_mn_counties_items.json
    A msautotest/api/expected/ogcapi_collections_mn_counties_items_by_id.json
    A msautotest/api/expected/ogcapi_collections_mn_counties_items_by_id_not_found.json.txt
    A msautotest/api/expected/ogcapi_collections_mn_counties_items_limit_1.json
    A msautotest/api/expected/ogcapi_collections_mn_counties_items_limit_1_offset_2.json
    A msautotest/api/expected/ogcapi_collections_mn_counties_items_limit_bbox_empty_result.json
    A msautotest/api/expected/ogcapi_collections_mn_counties_items_unknown_parameter.json.txt
    A msautotest/api/expected/ogcapi_root.html.txt
    A msautotest/api/expected/ogcapi_root.json
    A msautotest/api/expected/ogcapi_root.json.txt
    A msautotest/api/ogcapi.map
    A msautotest/api/run_test.py
    M msautotest/pytest.ini
    M print-test-results.sh
    M scripts/cppcheck.sh
    A share/ogcapi/templates/html-bootstrap4/collection-item.html
    A share/ogcapi/templates/html-bootstrap4/collection-items.html
    A share/ogcapi/templates/html-bootstrap4/collection.html
    A share/ogcapi/templates/html-bootstrap4/collections.html
    A share/ogcapi/templates/html-bootstrap4/conformance.html
    A share/ogcapi/templates/html-bootstrap4/debug.html
    A share/ogcapi/templates/html-bootstrap4/footer.html
    A share/ogcapi/templates/html-bootstrap4/header.html
    A share/ogcapi/templates/html-bootstrap4/landing.html
    A share/ogcapi/templates/html-bootstrap4/openapi.html
    A share/ogcapi/templates/html-plain/collection-item.html
    A share/ogcapi/templates/html-plain/collection-items.html
    A share/ogcapi/templates/html-plain/collection.html
    A share/ogcapi/templates/html-plain/collections.html
    A share/ogcapi/templates/html-plain/conformance.html
    A share/ogcapi/templates/html-plain/debug.html
    A share/ogcapi/templates/html-plain/footer.html
    A share/ogcapi/templates/html-plain/header.html
    A share/ogcapi/templates/html-plain/landing.html
    A share/ogcapi/templates/html-plain/openapi.html
    A third-party/include_nlohmann_json.hpp
    A third-party/include_pantor_inja.hpp
    A third-party/nlohmann/json.hpp
    A third-party/pantor/inja.hpp

  Log Message:
  -----------
  OGC API Proof-of-Concept (#6180)

* Extend mapservObj with a couple of API related parameters.

* Basic plumbing to detect/direct API requests.

* Use msSetError() instead of writing errors internally.

* Set the mapfile from CGI parameters or an API call.

* Added a bit of clean-up associated with api params in the mapservObj.

* Stubbed in the API dispatch function.

* More initial setup work so things work with cmake. Added intial version of mapogcapi.cpp.

* Added OGCAPI support to msGetVersion() output.

* Add mapocgapi source/header files.

* Initial version with trivial dispatcher...

* Initial version...

* Call API request dispatcher.

* Updated with Even's comments.

* Flipped mapfile and API signature order (mapfile is first).

* Added nlohmann/json...

* Initial idea for storing templates associated with an API - a share directory could be useful for other non-code artifacts.

* Added and OGC API-specific error code/message.

* Stubbed in some response functions, not that they do anything yet.

* String comparisons for API components should be exact.

* Make sure msCGIIsAPIRequest() is always called (changed order in if-statement).

* Adding local copy of inja templating lib - requires nlohmann/json which is conveniently already in use.

* A bit more fully-baked setup with JSON and HTML output for a conformance request.

* Add header/footer HTML includes to demonstrate Bootstrap integration.

* Added convenience template to display request summary data. Useful for debugging...

* Added OGC API namespace (A) to msOWSLookupMetadata() - oga_* (OCG Geospatial API).

* Get the template directory from metadata OR environment variable.

* Updated layout...

* Moved html templates into their own directory - allowing for multiple types of templates...

* Stubbed in landing and collections handling. Updated templates with navigation (banner links, breadcrumb, JSON access).

* Removed dependency on optional link properties.

* A little more meat added to the collections response.

* Added collection item type (fixed as Feature) and bbox (CRS84).

* Stubbed in collection-level (e.g. /collections/{collectionId}) handling.

* Updated references to nlohmann/json.hpp to use the local copy (e.g. ../nlohmann/json.hpp). This will need to be repeated as new versions are integrated (it's easy).

* Switched back to the default mustache template notation...

* Nest the JSON response object in a parent object so that the whole response could be assigned to a variable in HTML/JavaScript if necessary. So the JSON passed to a template has response and template members.

* Add support for arbitrary template-related tags - map-level only at the moment. Updated debug include to require a tag named debug with value of true to trigger the display.

* Reconciled metadata namespace use with proposed RFC draft. Shortened name artibitrary HTML tags to oga_html_tags...

* Added comments... Throw an error with custom link JSON parsing.

* Switch template directory configuration to incorporate the format - allows for multiple templated formats to be used if necessary. So, oga_template_directory becomes oga_html_template_directory. Same thing applies to environment variable-based configuration.

* Added hook to set PATH_INFO from the command line. Will be useful for msautotest and APIs.

* Stubbing in collection items support.

* Added helper functions to convert a string to double/int. Might be useful else where.

* Started update to use msSetError()/msGetErrorString().

* Got basic properties being output.

* Stubbed in constant support.

* Not supporting groups yet...

* Finished off getFeatureGeometry().

* Removed unused variable...

* Refactored things to rely on query functions for paging. Fixed shape projection to EPSG:4326.

* Added function to round geometry coordinates to a certain number of decimal places. Mostly works...

* Refactored error handling to return proper status codes.

* Got breadcrumb working.

* Updated, table of items now rendering.

* Avoid searching if there's no query string - common in API case.

* Got items/id call working.

* Items/id returns a feature, not a feature collection.

* Added check that OGC API requests are enabled at the map-level. Kinda all or nothing...

* Switched to configuring custom links using individual metadata elements rather than embedded JSON.

* Moved api path stuff to the cgiResponseObj. Easier to re-use and pass around.

* Handle relative template directory.

* Couple of html tag errors.

* Added a set of plain HTML templates. Will be better for msautotest.

* Added support for setting map and layer-level max limit values.

* Exclude third-party directory from cpp check.

* Examine query output - counts and so forth...

* Added checks to limit layer/collection inclusion.

* Remove const declaration from path_info.

* Hide api-related additions to cgiRequestObj from SWIG.

* Added support for geometry precision.

* Make avoid clashes with other versions of nlohmann/json.hpp.

* Fixed minor typo. Add GML namespace for feature id lookup.

* Trap error where an invalid item is set for gml_featureid.

* Start of tests for ogcapi.

* Set api_path to NULL after freeing.

* Only save non-zero length path components from path_info. Allows us to be more flexible...

* Make msautotest/api runnable

* OGCAPI: header.html: add UTF-8 declaration to please W3C HTML validator

* Code formatting fixes

* OGC API: use HTTP Accept header to figure out the output format when f= is not specified

* OGCAPI: add other tests

* OGC API: rename numMatched and numReturned properties as per the spec

* Makefile: add msautotest/api

* mapogcapi.cpp: getBbox(): cppify a bit

* OGC API: fix handling of a result with 0 features

* OGC API: test request by id

* OGC API: add paging support with offset= parameter

* OGC API: fix/make it work with Firefox without &f=html

* OGC API: implement /api endpoint

* github workflow: add validation of msautotest/api/expected/ogcapi_api.json

* OGC API: add testing of /conformance

* Update expected/ogcapi_collections.json

* print-test-results.sh: update it for api

* OGC API: interpret curl default 'Accept: */*' as asking for JSON output

* OGC API: fix 'rel' values for landing page

* OGC API: add links to /collections/coll/items/id response, and error out on unhandled query parameter

* OGC API: add a oga_default_limit to modify the default limit of 10 features

* mapogcapi.cpp: constify and other tiny code enhancements

* OGC API: honor gml_{attrname}_type when composing GeoJSON

* CMakeLists.txt: install ogcapi templates into ${MAPSERVER_DATA_SUBDIR}

* OGC API: round bbox in /collections/{id} to fix test issues with PROJ < 7

* Updated to latest version of inja.

* Updated Swagger UI versions and I think I have the right code included. Page renders but still needs some work.

* Simplified things a bit by combining conditionals into a single test.

* Updated template to account for numMatched/Returned -> numberMatched/Returned change.

* Added a check to make sure the bbox is well-formed (e.g. minx<maxx, miny<maxy).

* Allow bbox to be degenerate (e.g. a point)...

Co-authored-by: Even Rouault <even.rouault at spatialys.com>




More information about the mapserver-commits mailing list