koopjs / koop

Transform, query, and download geospatial data on the web.
http://koopjs.github.io
Other
667 stars 128 forks source link

Configure metadata dateFieldsTimeReference and advancedQueryCapabilities #599

Open despainm opened 1 year ago

despainm commented 1 year ago

It appears the dateFieldsTimeReference and advancedQueryCapabilities fields can not be configured by a provider.

For example, I'd like to set advancedQueryCapabilities.supportsPaginationOnAggregatedQueries = false and I'd like to explicitly set the dateFieldsTimeReference to be

"dateFieldsTimeReference": {
   "timeZone": "UTC",
   "respectsDaylightSaving": false
}

Based on the query api I think a dateFieldsTimeReference = null should be interpreted as UTC by default, but I'd like to explicitly set it.

 If the dateFieldsTimeReference property is not set, it will show up as null and the data will be assumed to be in UTC. In this case make sure you issue your WHERE clause in UTC
rgwozdz commented 1 year ago

There is a pathway for doing this now. You can add these properties to the set of "overridable defaults" for a layer. To do so, create a PR where you:

  1. Add default values here
  2. Add validation for the override values here.
  3. Use this.#overridables to set values here and here.
  4. Add tests to ensure defaults are overridden as expected.

Once this PR is merged and released, you would instantiate your Koop instance with:

const options = {
  geoserviceDefaults: {
    layer: {
      dateFieldsTimeReference: {
        timeZone: "UTC",
        respectsDaylightSaving: false
      },
      advancedQueryCapabilities: {
        supportsPaginationOnAggregatedQueries: false
      }
    }
  }
};

const koop = new Koop(options);