Home

Awesome

MapMaths.jl

Utility tools for working with various planetary coordinate systems.

Examples

Alternatives

There are two other Julia package which address similar needs as this one, namely CoordRefSystems and Geodesy. The below table attempts to summarise the key differences between them.

MapMathsCoordRefSystemsGeodesy
Ease of useAwkward syntax for coordinate conversions. <br> Doesn't automatically promote ints to floats.
Global coordinate typesLatLon, WebMercator, ECEFToo many to list them all.LatLon, ECEF, UTM
Local coordinatesCurved (tangential is WIP):x:Tangential (ENU)
Datum supportWGS84 onlyManyMany
Unitful:x::white_check_mark::x:
Reference package:x:PROJGeographicLib

We hope that eventually these three packages can evolve into a single one that is best at everything. Until then, we recommend CoordRefSystems as the default choice due to its professional maintenance and long feature list, but we also warmly invite you to keep an eye on this package as a testbed for highly powerful and flexible coordinate arithmetic.

API

Types

Abstract coordinate types
Latitude / longitude coordinate types
WebMercator coordinate types

WebMercator coordinates are shifted and scaled such that we have the following identities.

julia> @assert WebMercator(LonLat( 0, 0 ))[] == (0, 0)

julia> @assert WMX(Lon(180))[] == +1

julia> @assert WMY(Lat(90))[] == +Inf
Easting / northing coordinate types

Example:

julia> EastNorth(LatLon(0,90))
EastNorth{Float64}(1.0018754171394622e7, 0.0)

julia> EastNorth(LatLon(90, 0))
EastNorth{Float64}(0.0, 1.0001965729312724e7)

(Aside: the above shows that the earth is not a sphere, and that the meter has diverged from its historical definition.)

Further coordinate types

Functions

Coordinate conversion
Computing distances
Coordinate arithmetic
Utility functions