geospatial
geospatial copied to clipboard
Consistent factories for GeoJSON and OGC API Features clients
Currently client instances created using factory functions.
GeoJSON
client:
/// A client for accessing a `GeoJSON` data resource at [location] via http(s)
/// conforming to [format].
///
/// The required [location] should refer to a web resource containing GeoJSON
/// compliant data.
///
/// When given the optional [client] is used for http requests, otherwise the
/// default client of the `package:http/http.dart` package is used.
///
/// When given [headers] are injected to http requests (however some can be
/// overridden by the feature source implementation).
///
/// When [format] is not given, then [GeoJSON] with default settings is used as
/// a default. Note that currently only GeoJSON is supported, but it's possible
/// to inject another format implementation (or with custom configuration) to
/// the default one.
BasicFeatureSource geoJsonHttpClient({
required Uri location,
http.Client? client,
Map<String, String>? headers,
TextReaderFormat<FeatureContent> format = GeoJSON.feature,
});
OGC API Features
client:
/// A client for accessing `OGC API Features` compliant sources via http(s)
/// conforming to [format].
///
/// The required [endpoint] should refer to a base url of a feature service.
///
/// When given the optional [client] is used for http requests, otherwise the
/// default client of the `package:http/http.dart` package is used.
///
/// When given [headers] are injected to http requests (however some can be
/// overridden by the feature service implementation).
///
/// When [format] is not given, then [GeoJSON] with default settings is used as
/// a default. Note that currently only GeoJSON is supported, but it's possible
/// to inject another format implementation (or with custom configuration) to
/// the default one.
OGCFeatureService ogcApiFeaturesHttpClient({
required Uri endpoint,
http.Client? client,
Map<String, String>? headers,
TextReaderFormat<FeatureContent> format = GeoJSON.feature,
});
Another refers to an API endpoint by location
, and another by endpoint
. Choose one of these to be consistent.
Also consider similar factories as encoders / decoder on formats provider by geobase
package:
GeoJsonClient.http(....);
GeoJsonClient.local(....);
OGCAPI.features(....)
Also there should be convenient helper methods to map generic Feature
and FeatureCollection
objects (GeoJSON data model) to domain specific data models.