geodata 0.7.0
geodata: ^0.7.0 copied to clipboard

A geospatial client to read GeoJSON and other geospatial data sources.

GeoJSON and OGC API clients for Dart

pub package License

Key features:

  • Client-side data source abstractions
    • common geospatial Web APIs
    • geospatial feature services
  • Data source implementations to read geospatial features
  • Also (partially) conforming to following standards

This package is at BETA stage, interfaces not fully final yet.

Usage #

This sample shows to read GeoJSON features from a web resource using a HTTP fetcher, and from a local file using a file fetcher.

Please see other examples too.

import 'package:datatools/fetch_http.dart';
import 'package:datatools/fetch_file.dart';

import 'package:geodata/geojson_features.dart';

Future<void> main(List<String> args) async {
  // read GeoJSON for earthquakes from web using HTTP fetcher
  print('GeoJSON features from HTTP');
  await _readFeatures(
    HttpFetcher.simple(endpoints: [

  // same thing but files using a file fetcher to read a local file
  print('GeoJSON features from file');
  await _readFeatures(

Future<void> _readFeatures(Fetcher client, String collectionId) async {
  // create feature source using the given Fetch API client
  final source = FeatureSourceGeoJSON.of(
    client: client,
    meta: DataSourceMeta.collectionIds([collectionId], title: 'Earthquakes'),

  // read features with error handling
  try {
    // get items or features from collection id, maximum 5 features returned
    final items = await source.items(
      filter: FeatureFilter(limit: 5),

    // do something with features, in this sample just print them out
    for (final f in items.features) {
      print('Feature with id: ${}');
      print('  geometry: ${f.geometry}');
      print('  properties:');
      for (final key in {
        print('    $key: ${[key]}');
  } on OriginException catch (e) {
    final msg = e.isNotFound ? 'not found' : 'status code ${e.statusCode}';
    print('Origin exception: $msg');
  } on Exception catch (e) {
    print('Other exception: $e');

Installing #

The package supports Dart null-safety and using it requires at least Dart 2.12 from the stable channel. Please see the official null-safety migration guide.

In the pubspec.yaml of your project add the dependency:

  geodata: ^0.7.0 

All dependencies used by geodata are also ready for null-safety!

Package #

This is a Dart code package named geodata under the geospatial repository.

The package is associated with and depending on the datatools package containing non-geospatial tools to fetch data from HTTP and file resources. The geodata package then provides client-side access for geospatial APIs and data sources.

This package also utilizes the geocore package for geometry, metadata and feature data structures and GeoJSON parser, and the attributes package for non-geospatial data structures.

Libraries #

The package contains following mini-libraries:

api_commonData source abstraction for client access of common geospatial Web APIs.
api_featuresData source abstraction for client access of geospatial features Web APIs.
geojson_featuresA client-side data source to read GeoJSON features from a Web API or files.
oapi_commonData source abstraction for client access of OGC API Common based services.
oapi_featuresA client-side data source to read features from OGC API Features services.

For example to access a mini library you should use an import like:

import 'package:geodata/oapi_features.dart';

To use all libraries of the package:

import 'package:geodata/geodata.dart';

Authors #

This project is authored by Navibyte.

More information and other links are available at the geospatial repository from GitHub.

License #

This project is licensed under the "BSD-3-Clause"-style license.

Please see the LICENSE.

pub points


A geospatial client to read GeoJSON and other geospatial data sources.

Repository (GitHub)
View/report issues


API reference


BSD-3-Clause (LICENSE)


attributes, datatools, equatable, geocore, meta, synchronized


Packages that depend on geodata