Skip to content
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

Restructuring web api client for geospatial data #46

Closed
navispatial opened this issue Dec 3, 2021 · 2 comments
Closed

Restructuring web api client for geospatial data #46

navispatial opened this issue Dec 3, 2021 · 2 comments
Labels
🌎 geodata Related to the code package "geodata" enhancement New feature or request refactoring

Comments

@navispatial
Copy link
Member

DRAFT for some future version (0.8 or 0.9 maybe).

Planned structure for restructuring web api client for geospatial data, something like this

  • base/
    • features/
      • FeatureStore.dart
  • geojson/
    • GeoJsonFeatureService.dart (with default impl using "http(s)" binding)
    • GeoJsonFeatureStore.dart
  • ogcapi/
    • common/
      • data/
        • ItemsMeta.dart
        • ResourceMeta.dart
    • features/
      • data/
        • FeaturesMeta.dart
      • service/
        • OGCFeatureService.dart (with default impl using "http(s)" binding)
      • store/
        • OGCFeatureStore.dart

Services do not have common abstractions, as different services differ so much starting from standard specific stuff.

However FeatureStore above is meant to be common abstraction, letting accessing features (or other geospatial data) from different service types with shared interface. Services just provide async methods to access remote and local resources. Stores uses services, and may combine different services, and may cache data, and has mechanism to notify listeners.

@navispatial navispatial added enhancement New feature or request 🌎 geodata Related to the code package "geodata" refactoring labels Dec 3, 2021
@navispatial
Copy link
Member Author

Restuctured and refactored the codebase for geodata quite substantially, starting from the pre-release 0.8.0-a.7 of the BETA version 0.8.0.

New folder structure:

  • common
    • links
    • meta
    • paged
  • core
    • base
    • data
    • features
  • geojson
    • service
      • client
  • ogcapi_features
    • model
    • service
      • client
  • utils
    • features

And minilibraries as described on readme:

The package contains also following mini-libraries, that can be used to import
only a certain subset instead of the whole geodata library:

Library Export also Description
common Common data structures and helpers (for links, metadata, paged responses).
core Metadata and data source abstractions of geospatial Web APIs (ie. features).
geojson_client common, core A client-side data source to read GeoJSON data from web and file resources.
ogcapi_features_client common, core A client-side data source to read features from OGC API Features services.

All the mini-libraries have dependencies to equatable and geocore packages.

The geojson_client and ogcapi_features_client libraries depends also on the http package.

The geojson_client package uses dart:io functions for file access too.

Generic feature data source defined on common:

/// A feature source providing geospatial features.
abstract class FeatureSource<ItemType extends FeatureItem,
    ItemsType extends FeatureItems> {
  /// Fetches a single feature by id (set in [query]) from this source.
  ///
  /// Throws [FeatureException] in a case of a failure.
  Future<ItemType> item(FeatureItemQuery query);

  /// Fetches features matching [query] from this source.
  ///
  /// This call accesses only one set of feature items (number of returned items
  /// can be limited).
  ///
  /// Throws [FeatureException] in a case of a failure.
  Future<ItemsType> items(FeatureItemsQuery query);

  /// Fetches features (as paged sets) matching [query] from this source.
  ///
  /// This call returns a first set of feature items (number of returned items
  /// can be limited), with a link to an optional next set of feature items.
  ///
  /// Throws [FeatureException] in a case of a failure.
  Future<Paged<ItemsType>> itemsPaged(FeatureItemsQuery query);
}

GeoJSON implementation implements this data source as is.

OGC API Features implementation specializes the data source:

```dart
/// A feature source compliant with the OGC API Features standard.
abstract class OGCFeatureSource
    extends FeatureSource<OGCFeatureItem, OGCFeatureItems> {
  /// Get metadata about the feature collection represented by this source.
  Future<CollectionMeta> meta();
}

.. and a service is modeled:

/// A feature service compliant with the OGC API Features standard.
abstract class OGCFeatureService {
  /// Get meta data (or "landing page" information) about this service.
  Future<ResourceMeta> meta();

  // todo API description: api();

  /// Conformance classes this service is conforming to.
  Future<Iterable<String>> conformance();

  /// Get metadata about feature collections provided by this service.
  Future<Iterable<CollectionMeta>> collections();

  /// Get a feature source for a feature collection identified by [id].
  Future<OGCFeatureSource> collection(String id);
}

navispatial added a commit that referenced this issue Jan 8, 2022
@navispatial
Copy link
Member Author

Implemented in pre-release 0.8.0-a.7 of the upcoming BETA-version 0.8.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌎 geodata Related to the code package "geodata" enhancement New feature or request refactoring
Projects
None yet
Development

No branches or pull requests

1 participant