New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check conformance classes known by OGC API Features #169
Labels
Comments
navispatial
added
enhancement
New feature or request
🌐 geobase
Related to the code package "geobase"
🌎 geodata
Related to the code package "geodata"
and removed
🌐 geobase
Related to the code package "geobase"
labels
Mar 15, 2023
navispatial
added a commit
that referenced
this issue
Jul 5, 2023
BREAKING CHANGE: type of conformance from service changed
Implemented by 2535da0 A new class import 'package:equatable/equatable.dart';
import 'package:meta/meta.dart';
/// A wrapper for conformance classes for a OGC API Features compliant service.
///
/// See [OGC API Features](https://github.com/opengeospatial/ogcapi-features).
///
/// This class can be used to check conformance classes for:
/// * `OGC API - Features - Part 1: Core`
/// * `OGC API - Features - Part 2: Coordinate Reference Systems by Reference`
@immutable
class OGCFeatureConformance extends Equatable {
/// Conformance classes a service is conforming to.
final Iterable<String> classes;
/// Creates a wrapper for conformance classes a service is conforming to.
const OGCFeatureConformance(this.classes);
/// Check whether a service conforms to `OGC API - Features - Part 1: Core`
///
/// Optionally also check whether it supports [openAPI30Class],
/// [htmlClass], [geoJSONClass], [gmlSF0] and/or [gmlSF2].
bool conformsToCore({
bool? openAPI30,
bool? html,
bool? geoJSON,
bool? gmlSF0,
bool? gmlSF2,
}) {
var isCore = false;
var isOpenAPI30 = false;
var isHTML = false;
var isGeoJSON = false;
var isGMLSF0 = false;
var isGMLSF2 = false;
for (final id in classes) {
if (!isCore && id == coreClass) {
isCore = true;
}
if (!isOpenAPI30 && id == openAPI30Class) {
isOpenAPI30 = true;
}
if (!isHTML && id == htmlClass) {
isHTML = true;
}
if (!isGeoJSON && id == geoJSONClass) {
isGeoJSON = true;
}
if (!isGMLSF0 && id == gmlSF0Class) {
isGMLSF0 = true;
}
if (!isGMLSF2 && id == gmlSF2Class) {
isGMLSF2 = true;
}
}
return isCore &&
(openAPI30 == null || isOpenAPI30 == openAPI30) &&
(html == null || isHTML == html) &&
(geoJSON == null || isGeoJSON == geoJSON) &&
(gmlSF0 == null || isGMLSF0 == gmlSF0) &&
(gmlSF2 == null || isGMLSF2 == gmlSF2);
}
/// Check whether a service conforms to
/// `OGC API - Features - Part 2: Coordinate Reference Systems by Reference`.
bool conformsToCrs() => classes.contains(crsClass);
@override
List<Object?> get props => [classes];
static const coreClass =
'http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/core';
static const openAPI30Class =
'http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/oas30';
static const htmlClass =
'http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/html';
static const geoJSONClass =
'http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/geojson';
static const gmlSF0Class =
'http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/gmlsf0';
static const gmlSF2Class =
'http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/gmlsf2';
static const crsClass =
'http://www.opengis.net/spec/ogcapi-features-2/1.0/conf/crs';
} |
This was referenced Jul 19, 2023
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
The OGC API Features standard defines that a server should announce conformance classes supported by an API instance in
/conformance
resource.A JSON response by a compliant server could be for example:
See also official example by OGC.
Currently conformance classes could be checked by code like:
However a client code would have to know text identifiers, which is quite inconvenient.
The check should be something like this:
The text was updated successfully, but these errors were encountered: