GeoServer
  1. GeoServer
  2. GEOS-4596

RESTConfig doesn't auto-configure Coverages (SRS/Bounds) like it does with FeatureTypes/WMS

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.0
    • Fix Version/s: 2.1.2, 2.2.x
    • Component/s: Configuration
    • Labels:
      None
    • Number of attachments :
      3

      Description

      If you do a POST to /rest/workspaces/foo/coveragestores.json:

      {
        "coverageStore": {
          "name": "myCoverage",
          "workspace": {
            "name": "foo"
          },
          "type": "ImagePyramid",
          "enabled": true,
          "url": "/path/to/my/pyramid"
        }
      }
      

      and then a second POST to /rest/workspaces/foo/coveragestores/myCoverage/coverages.json to create the coverage:

      {
        "coverage": {
          "name": "myCoverage",
          "nativeName": "myCoverage",
          "title": "My Coverage",
          "abstract": "Some description",
          "srs": "EPSG:2193",
          "projectionPolicy": "FORCE_DECLARED",
          "enabled": true,
          "nativeFormat": "ImagePyramid",
          "defaultInterpolationMethod": "bilinear",
          "parameters": {
              "entry": [{
                  "string": ["AllowMultithreading", True]
              }]
          },
          "requestSRS": {
              "string": "EPSG:2193"
          },
          "responseSRS": {
              "string": "EPSG:2193"
          }
        }
      }
      

      The coverage creates fine, but the Native/LatLon bounds are not set – which then crashes (eg. GetCapabilities) requests and generally does bad things. Obviously I can specify them manually, but it'd be miles better if GeoServer auto-calculated them like it does in the UI. The same POSTs work fine for Feature Types and the bounds are auto-calculated.

      Looking at the code, there are CatalogBuilder.initFeatureType() and CatalogBuilder.initWMSLayer() methods which do this auto-detection, but the same thing doesn't occur for coverages. CatalogBuilder.buildCoverage(AbstractGridCoverage2DReader reader, Map customParameters) does it, but is only called for PUT requests which include an attached file, not for POST requests.

      Thoughts?

        Activity

        Hide
        Justin Deoliveira added a comment -

        Hi Robert,

        Yeah, looks like you nailed it, something missing for the coverage case. Any chance you are interested in whipping up a patch?

        Show
        Justin Deoliveira added a comment - Hi Robert, Yeah, looks like you nailed it, something missing for the coverage case. Any chance you are interested in whipping up a patch?
        Hide
        Tony Young added a comment -

        Here's a preliminary patch for autodetecting bounding boxes and projection policy when POSTing coverage info.

        Show
        Tony Young added a comment - Here's a preliminary patch for autodetecting bounding boxes and projection policy when POSTing coverage info.
        Hide
        Andrea Aime added a comment -

        Hey Tony, thanks for the contribution. The patch seems almost ready for commit, it just lacks a test, I guess you can extend the existing CoverageTest or CoverageStoreTest

        Show
        Andrea Aime added a comment - Hey Tony, thanks for the contribution. The patch seems almost ready for commit, it just lacks a test, I guess you can extend the existing CoverageTest or CoverageStoreTest
        Hide
        Tony Young added a comment -

        Hi Andrea,

        Would it be sufficient to just remove the latLonBoundingBox and nativeBoundingBox sections in the test XML of org.geoserver.catalog.rest.CoverageTest#testPostAsXML to test for the filling of missing values? Without autoconfiguration of bounds, it will raise an exception in the test.

        Show
        Tony Young added a comment - Hi Andrea, Would it be sufficient to just remove the latLonBoundingBox and nativeBoundingBox sections in the test XML of org.geoserver.catalog.rest.CoverageTest#testPostAsXML to test for the filling of missing values? Without autoconfiguration of bounds, it will raise an exception in the test.
        Hide
        Tony Young added a comment -

        Updated patch file with test.

        Show
        Tony Young added a comment - Updated patch file with test.
        Hide
        Tony Young added a comment -

        Sorry about that, wrong diff.

        Show
        Tony Young added a comment - Sorry about that, wrong diff.
        Hide
        Andrea Aime added a comment -

        It seems a reasonable approach to testing, yeah. Cool, the patch is clean and complete.
        Now there is the last hurdle, I'm no rest-config maintainers, Justin is, but he's away in vacation for the current week too afaik.
        Let's see if he pops up, otherwise next weekend I'll have a second look at the patch and commit it (no promises, I might forget/have other duties)

        Show
        Andrea Aime added a comment - It seems a reasonable approach to testing, yeah. Cool, the patch is clean and complete. Now there is the last hurdle, I'm no rest-config maintainers, Justin is, but he's away in vacation for the current week too afaik. Let's see if he pops up, otherwise next weekend I'll have a second look at the patch and commit it (no promises, I might forget/have other duties)
        Hide
        Justin Deoliveira added a comment -

        Patch looks great Tony. Thanks for the contribution!

        Show
        Justin Deoliveira added a comment - Patch looks great Tony. Thanks for the contribution!
        Hide
        Tony Young added a comment - - edited

        Wrong ticket, sorry.

        Show
        Tony Young added a comment - - edited Wrong ticket, sorry.
        Hide
        Andrea Aime added a comment -

        Mass transition all resolved issue that did not see any further comment in the last month to closed status

        Show
        Andrea Aime added a comment - Mass transition all resolved issue that did not see any further comment in the last month to closed status

          People

          • Assignee:
            Justin Deoliveira
            Reporter:
            Robert Coup
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: