GeoMakie
Geographic plotting utilities for <a href = "https://www.github.com/JuliaPlots/Makie.jl"><img src="https://raw.githubusercontent.com/JuliaPlots/Makie.jl/master/assets/logo.png" alt="Makie.jl" height="30" align = "top"></a>
Installation
This package is in development and will break often. As it is currently unregistered, you can install it from the REPL like so:
]add https://github.com/JuliaPlots/GeoMakie.jl
Examples
using GeoMakie, Makie
lons = LinRange(-179.5, 179.5, 360)
lats = LinRange(-89.5, 89.5, 180)
field = [exp(cosd(l)) + 3(y/90) for l in lons, y in lats]
source = LonLat()
dest = WinkelTripel()
xs, ys = xygrid(lons, lats)
Proj4.transform!(source, dest, vec(xs), vec(ys))
scene = surface(xs, ys; color = field, shading = false, show_axis = false, scale_plot = false)
geoaxis!(scene, extrema(lons), extrema(lats); crs = (src = source, dest = dest,))
coastlines!(scene; crs = (src = source, dest = dest,))
These plots can be arbitrarily colored using the color
keyword, and the full Makie interface is also exposed.
Check the examples in the test
folder for more recent examples of usage.
Performance
We use Earcut.jl for added performance when converting polygons to triangular meshes; it decreases time to mesh by an order of magnitude from the Makie implementation.
Since surface
has an optimized shader, and can accept matrices of deformed grid points, it's heavily recommended to use it (or mesh
if you need the flexibility) over poly
.
Planned features
- A
choropleth
recipe which can read data from the properties of a FeatureCollection - helper functions to extract "columns" of a FeatureCollection
More examples
using GeoJSON, GeoMakie, Makie
states = download("https://raw.githubusercontent.com/PublicaMundi/MappingAPI/master/data/geojson/us-states.json")
states_geo = GeoJSON.parse(read(states, String))
poly(states_geo, strokecolor = :blue, strokewidth = 1)