Skip to content

MakieOrg/GeoMakie.jl

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
Sep 20, 2022
src
Oct 25, 2022
Sep 21, 2022
Sep 12, 2022

GeoMakie

Geographic plotting utilities for Makie.jl Makie.jl

Stable Dev CI

This package is in development, and may break often. You can install it from the REPL like so:

]add GeoMakie

To check the version, run:

julia> ]
pkg> status GeoMakie

To use, simply type using GeoMakie into the REPL. You will also have to include the backend of your choice - we sugggest using GLMakie for interactive use and using CairoMakie for PDF or SVG output.

Quick start

The main entry point to GeoMakie is the function GeoAxis(fig[i, j]; kw_args...). It creates an axis which accepts nonlinear projections, but is otherwise identical in usage to Makie's Axis. Projections are accepted as PROJ-strings, and can be set through the source="+proj=latlong +datum=WGS84" and dest="+proj=eqearth" keyword arguments to GeoAxis.

fig = Figure()
ga = GeoAxis(
    fig[1, 1]; # any cell of the figure's layout
    dest = "+proj=wintri", # the CRS in which you want to plot
    coastlines = true # plot coastlines from Natural Earth, as a reference.
)
scatter!(ga, -120:15:120, -60:7.5:60; color = -60:7.5:60, strokecolor = (:black, 0.2))
fig

geoax2

As you can see, the axis automatically transforms your input from the source CRS (default "+proj=longlat +datum=WGS84") to the dest CRS.

You can also use quite a few other plot types and projections:

fieldlons = -180:180; fieldlats = -90:90
field = [exp(cosd(lon)) + 3(lat/90) for lon in fieldlons, lat in fieldlats]

img = rotr90(GeoMakie.earth())
land = GeoMakie.land()

fig = Figure(resolution = (1000, 1000))

ga1 = GeoAxis(fig[1, 1]; dest = "+proj=ortho", coastlines = true, lonlims = (-90, 90), title = "Orthographic\n ")
ga2 = GeoAxis(fig[1, 2]; dest = "+proj=moll", title = "Image of Earth\n ")
ga3 = GeoAxis(fig[2, 1]; coastlines = false, title = "Plotting polygons")
ga4 = GeoAxis(fig[2, 2]; dest = "+proj=natearth", title = "Auto limits") # you can plot geodata on regular axes too

surface!(ga1, fieldlons, fieldlats, field; colormap = :rainbow_bgyrm_35_85_c69_n256, shading = false)
image!(ga2, -180..180, -90..90, img; interpolate = false) # this must be included
poly!(ga3, land[50:100]; color = 1:51, colormap = (:plasma, 0.5))
poly!(ga4, land[22]); datalims!(ga4)

fig

geoaxes

Instructions for the as/geoaxis branch

In the REPL, run ]add GeoMakie#as/geoaxis Makie#master CairoMakie#master MakieCore#master

To clean up, run the following in Julia:

using Pkg
Pkg.rm.(["GeoMakie", "Makie", "CairoMakie", "MakieCore"])
Pkg.add.(["Makie", "CairoMakie", "MakieCore"])

Please see the documentation for examples and basic usage.