geobase library

Geospatial data, spherical geodesy, projections, tiling schemes and vector data.

Key features:

  • geographic (longitude-latitude) and projected positions and bounding boxes
  • spherical geodesy functions for great circle and rhumb line paths
  • simple geometries (point, line string, polygon, multi point, multi line string, multi polygon, geometry collection)
  • features (with id, properties and geometry) and feature collections
  • temporal data structures (instant, interval) and spatial extents
  • vector data formats supported (GeoJSON, WKT, WKB)
  • coordinate projections (web mercator + based on the external proj4dart library)
  • tiling schemes and tile matrix sets (web mercator, global geodetic)

Usage: import package:geobase/geobase.dart

Classes

Aligned
An aligned point within a geospatial box or tile.
Bounded
A base interface for classes that know their bounding boxes.
Box
A base interface for axis-aligned bounding boxes with min & max coordinates.
BoxCoords
A geospatial bounding box as an iterable collection of coordinate values.
ContentDecoder
An interface to decode content from a text or binary format.
ContentEncoder<Content extends Object>
An interface to encode Content into a text or binary format.
Coordinates
Geospatial coordinate values as an iterable collection of double values.
CoordRefSys
Metadata about a coordinate reference system (CRS) identified and specified by id.
CoordRefSysResolver
An abstract class for resolving coordinate reference system information.
DefaultFormat
The "default" text format for coordinate and geometry objects.
Dms
A default implementation for DmsFormat abstract base class, that defines methods for parsing and formatting degrees/minutes/seconds on latitude, longitude and bearing values.
DmsFormat
A base class for formatters with methods for parsing and formatting degrees/minutes/seconds on latitude, longitude and bearing values.
Feature<T extends Geometry>
A feature is a geospatial entity with id, properties and geometry.
FeatureBuilder<T extends FeatureObject, E extends Geometry>
A builder to create geospatial feature objects of T from FeatureContent.
FeatureCollection<E extends Feature<Geometry>>
A feature collection contains an array of Feature items.
FeatureObject
A common base interface for geospatial feature objects (Feature and FeatureCollection).
GeoBox
A geographic bounding box with west, south, east and north values.
GeoExtent
A geospatial extent with spatial and optional temporal parts.
Geographic
A geographic position with longitude, latitude and optional elevation and m.
GeoJSON
The GeoJSON text format for coordinate, geometry and feature objects.
GeoJsonConf
Optional configuration parameters for formatting GeoJSON.
Geometry
A base interface for geometry classes.
GeometryBuilder<T extends Geometry, E extends Geometry>
A builder to create geometry objects of T from GeometryContent.
GeometryCollection<E extends Geometry>
A geometry collection with geometries.
GeoTileMatrixSet
A tile matrix set with conversions between tiles and geographic positions.
GlobalGeodeticQuad
"Global Geodetic Quad" tile matrix set ("World CRS84 Quad" for WGS 84).
Instant
An instant with a timestamp.
Interval
An interval between optional start and end instants.
LineString
A line string geometry with a chain of positions.
LonLat
A geographic position as an iterable collection of lon and lat values.
LonLatElev
A geographic position as an iterable collection of lon, lat and elev values.
LonLatElevM
A geographic position as an iterable collection of lon, lat, elev and m values.
LonLatM
A geographic position as an iterable collection of lon, lat and m values.
MultiLineString
A multi line string with an array of line strings (each with a chain of positions).
MultiPoint
A multi point geometry with an array of points (each with a position).
MultiPolygon
A multi polygon with an array of polygons (each with an array of rings).
Point
A point geometry with a position.
Polygon
A polygon geometry with one exterior and 0 to N interior rings.
Position
A base interface for geospatial positions.
Positionable
A positionable object has (geospatial) coordinate values available.
PositionArray
Coordinate values of geospatial positions as an iterable collection.
PositionCoords
A position as an iterable collection of coordinate values.
ProjBox
A bounding box with minX, minY, maxX and maxY coordinates.
Projected
A projected position with x, y, and optional z and m coordinates.
Scalable
A scalable object at the zoom level (a positive number).
Scalable2i
Scalable x, y coordinates at the zoom level.
ScaledConverter
A coordinate converter between geospatial positions and scaled coordinates.
SimpleGeometry
A base interface for "simple" geometry classes.
SimpleGeometryContent
An interface to write simple geometry data to format encoders and object builders.
SpatialExtent<T extends Box>
An extent with 1 to N bounding boxes in defined coordinate reference system.
SphericalGreatCircle
Latitude/longitude points on a spherical model earth, and methods for calculating distances, bearings, destinations, etc on (orthodromic) great-circle paths.
SphericalGreatCircleLineString
Calculations for line strings (as an iterable of geographic positions) on a spherical model earth (great-circle paths).
SphericalRhumbLine
Latitude/longitude points on a spherical model earth, and methods for calculating distances, bearings, destinations, etc on (loxodromic) rhumb lines.
Temporal
A base class for temporal objects like instants and intervals.
TemporalExtent
An extent with 1 to N intervals in defined temporal reference system.
TextReaderFormat<Content extends Object>
An interface to access text format decoders (readers) for Content.
TextWriterFormat<Content extends Object>
An interface to access text format encoders (writers) for Content.
TileMatrixSet
A tiling scheme represented as a set of tile matrices (grids).
WebMercatorQuad
"Web Mercator Quad" tile matrix set.
WGS84
Projections for the WGS 84 geographic coordinate system.
WKB
The Well-known binary (WKB) format, see geometry for accessing the format.
WKT
The WKT text format for coordinate and geometry objects.
WktLikeFormat
The WKT (like) text format for coordinate and geometry objects.
XY
A projected position as an iterable collection of x and y values.
XYM
A projected position as an iterable collection of x, y and m values.
XYZ
A projected position as an iterable collection of x, y and z values.
XYZM
A projected position as an iterable collection of x, y, z and m values.

Mixins

BinaryFormat<Content extends Object>
A mixin to access binary format encoders and decoders for Content
CoordinateContent
An interface to write coordinate data to format encoders and object builders.
FeatureContent
An interface to write geospatial feature objects to format encoders and object builders.
GeometryContent
An interface to write geometry data to format encoders and object builders.
PositionData<E extends Position>
A fixed-length and random-access view to positions with coordinate values.
Projection
A mixin defining an interface for (geospatial) projections.
ProjectionAdapter
A projection adapter bundles forward and inverse projections.
PropertyContent
An interface to write properties to format encoders and object builders.
TextFormat<Content extends Object>
A mixin to access text format encoders and decoders for Content.

Extensions

BoxCoordinatesExtension
A helper extension on Box to convert data as BoxCoords.
DoubleAngleExtension
An extension on double with basic degrees and radians utility methods.
ListCoordinateExtension
A helper extension on List<double> to handle coordinate values.
PositionCoordinatesExtension
A helper extension on Position to convert data as PositionCoords.
PositionIterableCoordinatesExtension
A helper extension on Iterable<Position> to convert data as PositionArray.
SphericalGreatCircleExtension
An extension for easier access to SphericalGreatCircle.
SphericalGreatCircleIterableExtension
An extension for easier access to SphericalGreatCircleLineString.
SphericalRhumbLineExtension
An extension for easier access to SphericalRhumbLine.

Constants

defaultEpsilon → const double
The default epsilon value 1.0e-9 used as a tolerance in equals2D, equals3D and similar methods in this package.
1.0e-9
doublePrecisionEpsilon → const double
The maximum relative precision of double numbers (IEEE 754).
2.220446049250313e-16
earthCircumferenceWgs84 → const double
The earth circumference in meters (from earth equatorial radius by WGS 84).
2 * math.pi * earthRadiusWgs84
earthRadiusWgs84 → const double
The earth equatorial radius in meters as specified by WGS 84.
6378137.0
maxLatitude → const double
The maximum value for the geographic latitude.
90.0
maxLatitudeWebMercator → const double
The maximum value for the geographic latitude inside the Web Mercator projection coverage.
85.05112878
maxLongitude → const double
The maximum value for the geographic longitude.
180.0
minLatitude → const double
The minimum value for the geographic latitude.
-90.0
minLatitudeWebMercator → const double
The minimum value for the geographic latitude inside the Web Mercator projection coverage.
-85.05112878
minLongitude → const double
The minimum value for the geographic longitude.
-180.0
screenPPIbyOGC → const double
OGC defines a screen pixel of 0.28 mm that approximates to 90.7 ppi.
0.0254 / 0.00028

Functions

clampLatitude(double lat) double
Returns a clipped latitude in the range [-90.0, 90.0].
distanceHaversine(Geographic position1, Geographic position2, {double earthRadius = 6371000.0}) double
Returns a distance in meters between position1 and position2.
normalizeLongitude(double lon) double
Returns a normalized longitude in the range [-180.0, 180.0[ by using the formula (lon + 180.0) % 360.0 - 180.0 (if outside the range).

Enums

AxisOrder
The axis order of coordinate values in position and point representations.
CanvasOrigin
The position of the origin in a canvas or a grid.
CardinalPrecision
The precision for cardinal directions (compass point).
Coords
An enum for coordinate types (by spatial dimension and whether is measured).
DmsType
An enum for common representation of geographic positions by coordinates (using degrees, minutes and seconds as components).
Geom
An enum for geometry types.
GeoRepresentation
An enum for spatial representations that can be used to code logic when need to choose some options based on a representation.

Typedefs

AddGeometry<T extends Geometry> = void Function(T geometry, {String? name})
A function to add geometry to some collection with an optional name.
CreateBox<T extends Box> = T Function({double? maxM, required double maxX, required double maxY, double? maxZ, double? minM, required double minX, required double minY, double? minZ})
Creates a new bounding box from minX, minY, maxX and maxY values.
CreatePosition<T extends Position> = T Function({double? m, required double x, required double y, double? z})
Creates a new position of T from x and y, and optional z and m.
TransformPosition = T Function<T extends Position>(T source)
A function to transform the source position of T to a position of T.
WriteFeatures = void Function(FeatureContent output)
A function to write geospatial feature objects to output.
WriteGeometries = void Function(GeometryContent output)
A function to write geometry data to output.
WriteProperties = void Function(PropertyContent output)
A function to write properties to output.
WriteSimpleGeometries = void Function(SimpleGeometryContent output)
A function to write simple geometry data to output.