GeoJSON client
The GeoJSON client allows fetching and reading geospatial feature collections with their geometry objects (ie. point, line string, polygon, multi point, multi line string, multi polygon and geometry collection) from following resource types:
- a web resource (by URL) containing GeoJSON content - data is fetched using the HTTP client (as provided by the http package)
- custom resources, ie. a local file or an app bundled containing valid GeoJSON data
Please note that this client is not related to OGC API Features or any other API protocol either, but you can access any (static) web or local resource with GeoJSON data.
π Read GeoJSON features
The sample below shows to read GeoJSON features from a web resource using the HTTP client.
The full sample for accessing GeoJSON feature sources is available in geojson_example.dart.
β€ Newline-delimited GeoJSON
GeoJSON or
newline-delimited GeoJSON
(or
GeoJSON Text Sequences)
is an optimized variant of GeoJSON to encode sequences of geospatial features.
A text file conforming to this format represents one feature collection (without
FeatureCollection element encoded). Such a file may contain any number of
features that are separated by the newline character (\n
).
Decoding and encoding data for this format is supported by the geobase package just like itβs supporting the standard GeoJSON too.
When accessing newline-delimited GeoJSON data with the geodata
package, you
should assign format: GeoJSONL.feature
when creating a feature source either
with GeoJSONFeatures.http()
or GeoJSONFeatures.any()
. Otherwise the usage
patterns introduced for the standard GeoJSON applies also here.