geodata 0.3.0-nullsafety.0
geodata: ^0.3.0-nullsafety.0 copied to clipboard
A geospatial client reading OGC API and other geospatial data sources.
Geospatial - geodata #
A geospatial client reading OGC API and other data sources for Dart and Flutter mobile developers.
Currently the package has a partial (and still quite limited) support for OGC API Features services with functions to read metadata and feature items.
This package is at the alpha-stage, breaking changes are possible.
This is a Dart code package named geodata
under the
geospatial repository. The package
supports Dart null-safety.
Installing #
The package is designed null-safety in mind and requires SDK from beta channel:
environment:
sdk: '>=2.12.0-0 <3.0.0'
More information about how to switch to the latest beta release of Dart or Flutter SDKs is available in the official null-safety migration guide. Please consult it first about null-safety.
Dependencies defined in the pubspec.yaml
when using the package:
dependencies:
geodata: ^0.3.0-nullsafety.0
Please note that following dependencies used by geodata
are not yet migrated
to null-safety or null-safety version is not
depended from the geodata
package:
Usage #
An example how to setup an API client and a provider for OGC API Features service.
Imports:
import 'package:geodata/geodata.dart';
Setting up an API client and a feature provider:
// Create an API client accessing HTTP endpoints.
final client = HttpApiClient.endpoints([
Endpoint.url(baseURL),
]);
// Create a feature provider for OGC API Features (OAPIF).
final provider = FeatureProviderOAPIF.client(client);
Now it's possible to access metadata (the provider implementation calls a landing page or '/', '/conformance' and '/collections' resources under a base URL and combines all metadata fetched):
// Read metadata
final meta = await provider.meta();
// do something with meta data accessed
Fetching items (or features of a OGC API Features service) as paged sets:
// Get feature resource for a collection by id
final resource = await provider.collection(collectionId);
// fetch feature items as paged results with max 10 features on one query
final items1 = await resource.itemsPaged(limit: 10);
// do something with feature items fetched
// check for next set (of max 10 features) and fetch it too if available
if (items1.hasNext) {
final items2 = await items1.next();
// do something with feature items fetched
}
Please see full example code for more details.
Authors #
This project is authored by Navibyte.
License #
This project is licensed under the "BSD-3-Clause"-style license.
Please see the LICENSE.