Geospatial
Geospatial data structures, tools and utilities for Dart and Flutter.
Install / Use
/learn @navibyte/GeospatialREADME
:compass: Geospatial tools for Dart
<a title="Stefan Kühn (Fotograf), CC BY-SA 3.0 <https://creativecommons.org/licenses/by-sa/3.0>, via Wikimedia Commons" href="https://commons.wikimedia.org/wiki/File:Azimutalprojektion-schief_kl-cropped.png"><img src="https://raw.githubusercontent.com/navibyte/geospatial_docs/v2023-08-12/assets/doc/projections/azimutal/Azimutalprojektion-schief_kl-cropped.png" align="right"></a>
Geospatial data structures, tools and utilities for Dart and Flutter - coordinates, geometries, feature objects, metadata, spherical geodesy, projections, tiling schemes, vector data models and formats, and geospatial Web APIs.
Read the docs 👉 geospatial.navibyte.dev!
🗺️ Roadmap 2025: The current state and candidate issues for the geobase package.
✨ New (2025-03-11): The stable version 1.5.0 with global grids, better WGS84 projection support and unit conversions.
✨ New (2024-11-10): The stable release with ellipsoidal geodesy functions letting you calculate distances, bearings, destination positions and intermediate points along the Earth surface accurately.
✨ New (2024-07-26): The stable version 1.3.0 with centroid, polylabel, point-in-polygon and other cartesian 2D calculations enhanced - read more!
:package: Packages
Dart code packages published at pub.dev:
Code | Package | Description
-------------- | --------| -----------
:globe_with_meridians: geobase | | Geospatial data structures (coordinates, geometries, features, metadata), ellipsoidal and spherical geodesy, projections and tiling schemes. Vector data format support for GeoJSON, WKT and WKB.
:earth_americas: geodata |
| Geospatial feature service Web APIs with support for GeoJSON and OGC API Features clients.
📚 Documentation
Comprehensive guidance on how to use package and about Geospatial tools for Dart is available on the geospatial.navibyte.dev website.
Overview topics about Geospatial tools for Dart:
The geobase package documentation by chapters:
- 📍 Coordinates
- 🧩 Simple geometries
- 📏 Geometry calculations
- 🔷 Geospatial features
- 📃 Vector formats
- 🔵 Ellipsoidal geodesy
- 📐 Spherical geodesy
- 📅 Metadata
- 🌐 Global grids
- 🗺️ Projections
- 🔢 Tiling schemes
- ⚖️ Unit conversions
The geodata package documentation by chapters:
:sparkles: Features
Key features of the geobase package:
- 🌐 geographic (longitude-latitude) and projected positions and bounding boxes
- 🧩 simple geometries (point, line string, polygon, multi point, multi line string, multi polygon, geometry collection)
- 📏 cartesian 2D calculations (centroid, polylabel, point-in-polygon, distance).
- 🔷 features (with id, properties and geometry) and feature collections
- 📐 ellipsoidal (vincenty) and spherical (great circle, rhumb line) geodesy tools, with ellipsoidal datum, UTM, MGRS and ECEF (earth-centric earth-fixed) support
- 📅 temporal data structures (instant, interval) and spatial extents
- 📃 vector data formats supported (GeoJSON, Newline-delimited GeoJSON, WKT, WKB )
- 🗺️ coordinate projections (built-in WGS84 based projections on geographic, geocentric, UTM and Web Mercator coordinates + external proj4dart support)
- 🔢 tiling schemes and tile matrix sets (web mercator, global geodetic)
- ⚖️ unit conversions (angle, angular velocity, area, distance, speed and time)
Key features of the geodata package:
- 🪄 Client-side data source abstraction for geospatial feature service Web APIs.
- 🌐 The GeoJSON client to read features from static web resources and local files, supports also Newline-delimited GeoJSON data.
- 🌎 The OGC API Features client to access metadata and feature items from a compliant geospatial Web API providing GeoJSON data.
Client-side support for the OGC API Features standard:
Standard part | Support in this package ------------- | ----------------------- OGC API - Features - Part 1: Core | Supported for accessing metadata and GeoJSON feature collections. OGC API - Features - Part 2: Coordinate Reference Systems by Reference | Supported. OGC API - Features - Part 3: Filtering<br/>Common Query Language (CQL2) | Partially supported (conformance classes, queryables, features filter).
:keyboard: Sample code
Geodesy functions with geobase
Ellipsoidal and spherical geodesy functions to calculate distances etc.:
final greenwich = Geographic.parseDms(lat: '51°28′40″ N', lon: '0°00′05″ W');
final sydney = Geographic.parseDms(lat: '33.8688° S', lon: '151.2093° E');
// How to calculate distances using ellipsoidal Vincenty, spherical
// great-circle and spherical rhumb line methods is shown first.
// The distance along a geodesic on the ellipsoid surface (16983.3 km).
greenwich.vincenty().distanceTo(sydney);
// By default the WGS84 reference ellipsoid is used but this can be changed.
greenwich.vincenty(ellipsoid: Ellipsoid.GRS80).distanceTo(sydney);
// The distance along a spherical great-circle path (16987.9 km).
greenwich.spherical.distanceTo(sydney);
// The distance along a spherical rhumb line path (17669.8 km).
greenwich.rhumb.distanceTo(sydney);
// Also bearings, destination points and mid points (or intermediate points)
// are provided for all methods, but below shown only for great-circle paths.
// Destination point (10 km to bearing 61°): 51° 31.3′ N, 0° 07.5′ E
greenwich.spherical.initialBearingTo(sydney);
greenwich.spherical.finalBearingTo(sydney);
// Destination point: 51° 31.3′ N, 0° 07.5′ E
greenwich.spherical.destinationPoint(distance: 10000, bearing: 61.0);
// Midpoint: 28° 34.0′ N, 104° 41.6′ E
greenwich.spherical.midPointTo(sydney);
// Vincenty ellipsoidal geodesy functions provide also `inverse` and `direct`
// methods to calculate shortest arcs along a geodesic on the ellipsoid. The
// returned arc object contains origin and destination points, initial and
// final bearings, and distance between points.
greenwich.vincenty().inverse(sydney);
greenwich.vincenty().direct(distance: 10000, bearing: 61.0);
Geospatial data structures with geobase
As a quick sample, this is how geometry objects with 2D coordinate are created using [geobase](https://pub
