http static method

BasicFeatureSource<FeatureItem, FeatureItems> http({
  1. required Uri location,
  2. Client? client,
  3. Map<String, String>? headers,
  4. TextReaderFormat<FeatureContent> format = GeoJSON.feature,
  5. CoordRefSys? crs,
})

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 an optional client is used for http requests, otherwise the default client of the package:http/http.dart package is used (a new instance of default client for each service request). When client is given, this allows a client to better maintain persistent connections to a service, but it's also responsibility of a caller to close it appropriately.

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.

Use crs to give hints (like axis order, and whether x and y must be swapped when read in) about coordinate reference system in text input.

Implementation

static BasicFeatureSource http({
  required Uri location,
  Client? client,
  Map<String, String>? headers,
  TextReaderFormat<FeatureContent> format = GeoJSON.feature,
  CoordRefSys? crs,
}) =>
    _GeoJSONFeatureSource(
      location,
      adapter: FeatureHttpAdapter(
        client: client,
        headers: headers,
      ),
      format: format,
      crs: crs,
    );