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
Consistent factories for GeoJSON and OGC API Features clients #155
Labels
Comments
navispatial
added
enhancement
New feature or request
🌎 geodata
Related to the code package "geodata"
refactoring
labels
Sep 5, 2022
Also there should be convenient helper methods to map generic |
Closed
Implemented in geodata 0.11.0-dev.0. The final implementation with small changes from plans above. GeoJSON Features client: /// A class with static factory methods to create feature sources conforming to
/// the GeoJSON format.
class GeoJSONFeatures {
/// 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.
static BasicFeatureSource http({
required Uri location,
Client? client,
Map<String, String>? headers,
TextReaderFormat<FeatureContent> format = GeoJSON.feature,
});
/// A client for accessing a `GeoJSON` feature collection from any [source];
///
/// The source function returns a future that fetches data from a file, a web
/// resource or other sources. Contents must be GeoJSON compliant data.
///
/// 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.
static BasicFeatureSource any(
Future<String> Function() source, {
TextReaderFormat<FeatureContent> format = GeoJSON.feature,
});
} OGC API Features client: /// A class with static factory methods to create feature sources conforming to
/// the OGC API Features standard.
class OGCAPIFeatures {
/// 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.
static OGCFeatureService http({
required Uri endpoint,
Client? client,
Map<String, String>? headers,
TextReaderFormat<FeatureContent> format = GeoJSON.feature,
});
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Currently client instances created using factory functions.
GeoJSON
client:OGC API Features
client:Another refers to an API endpoint by
location
, and another byendpoint
. Choose one of these to be consistent.Also consider similar factories as encoders / decoder on formats provider by
geobase
package:The text was updated successfully, but these errors were encountered: