Subnero, a wireless underwater communications company from sunny Singapore, proudly presents to the world the following two packages:
- MapMakie: Plot on OpenStreetMap using Makie.
- MapMaths: Utility tools for working with various planetary coordinate systems.
The purpose of MapMakie is pretty straightforward: it augments your Makie plots with OpenStreetMap raster tiles and thereby puts your abstract, hard-to-read geo-spatial data into an intuitive, real-world context. We are using MapMakie internally to create sophisticated, real-time visualisations of our modem deployments.
While working on MapMakie, we noticed that while the coordinate transformations provided by Geodesy are great, the API of that package is occasionally not quite as convenient as it could be: Int
isn’t consistently promoted to Float
, it is difficult to generically convert from one coordinate system another, and the support for WebMercator coordinates is somewhat halfhearted. All of these issues can of course be worked around, but as Julia programmers we wanted more and so we went ahead and created MapMaths.
MapMaths is very similar to Geodesy in terms of functionality but exposes these tools in what we believe to be a more user-friendly API. Perhaps the best example to illustrate the difference between Geodesy and MapMaths is the conversion from WebMercator to ECEF (earth-centred, earth-fixed) coordinate system.
julia> using Geodesy
julia> ECEF(LLAfromWebMercator(wgs84)([0,0,0]), wgs84)
ECEF(6.378137e6, 0.0, 0.0)
julia> using MapMaths
julia> ECEF(WebMercator(0,0))
ECEF{Float64}(6.378137e6, 0.0, 0.0)
As you can see, MapMaths’ API is 100% based on types, and this in turn means that the commands are shorter and fully generic - in the above example, you can replace both ECEF
and WebMercator
with any other coordinate type (e.g. LatLon
, EastNorth
, or WMX
(East-West component of WebMercator coordinates)), and as long as the conversion makes sense, everything will just work out as you would expect.
You can see the combined power of MapMakie and MapMaths in action in the following example from MapMakie’s README.
using GLMakie, MapMakie, MapMaths, Unitful
f = Figure()
a = MapAxis(
f[1,1];
origin = LatLon(1.286770, 103.854307), # Merlion, Singapore
ticks_coordinate = (EastNorth, u"km"),
limits = (East.(2e3.*(-1,1)), North.(2e3.*(-1,1))),
)
scatter!(
a,
Point2f[(0,0)], # WebMercator coordinates relative to `origin`
color = :red,
markersize = 15,
strokewidth = 6,
)
display(f)
save("/tmp/merlion.png", f)