GeoMakie.jl

Geographical plotting utilities for Makie.jl
Author JuliaPlots
Popularity
40 Stars
Updated Last
2 Years Ago
Started In
August 2019

GeoMakie

Geographic plotting utilities for Makie.jl

Stable Dev Build Status

Installation

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

]add GeoMakie

Examples

using GLMakie
using GeoMakie
using GeoMakie.GeoInterface
using GeoMakie.GeoJSON

begin
    source = LonLat()
    dest = WinkelTripel()
    states = download("https://raw.githubusercontent.com/PublicaMundi/MappingAPI/master/data/geojson/us-states.json")
    states_geo = GeoJSON.parse(read(states, String))
    lons = LinRange(-179.5, 179.5, 360 ÷ 2)
    lats = LinRange(-89.5, 89.5, 180 ÷ 2)
    field = [exp(cosd(l)) + 3(y/90) for l in lons, y in lats]
    fig = Figure()
    ax = fig[1,1] = Axis(fig)
    ax.scene.transformation.transform_func[] = GeoMakie.proj(source, dest)
    wireframe!(ax, lons, lats, field, color=(:gray, 0.2), transparency=true)
    n = length(GeoInterface.features(states_geo))
    lines!(ax, GeoMakie.coastlines())
    poly!(ax, states_geo, color= 1:n, strokecolor = :blue, strokewidth = 1)
    display(fig)
end

image

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)

US simple example