diff --git a/docs/make.jl b/docs/make.jl index 88229b48..913af4b9 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -28,6 +28,8 @@ examples = [ "orthographic.jl", "german_lakes.jl", "geostationary_image.jl", + "multiple_crs.jl", + joinpath("gmt", "antioquia.jl"), "contourf.jl", "world_population.jl", "field_and_countries.jl", @@ -35,7 +37,8 @@ examples = [ "projections.jl", "tissot.jl", "rotating_earth.jl", - joinpath("gmt", "antioquia.jl"), + "rasters.jl", + ] example_dir = joinpath(dirname(@__DIR__), "examples") for filename in examples diff --git a/examples/rasters.jl b/examples/rasters.jl index bfd672be..05e52c28 100644 --- a/examples/rasters.jl +++ b/examples/rasters.jl @@ -1,7 +1,40 @@ +# # Raster data (with Rasters.jl) +# [Rasters.jl](https://github.com/rafaqz/Rasters.jl) is a Julia package designed for working with raster data. +# It provides tools to read, write, and manipulate raster datasets, +# which are commonly used in geographic information systems (GIS), +# remote sensing, and similar fields where grid data is prevalent. +# It's built on top of [DimensionalData.jl](https://github.com/rafaqz/DimensionalData.jl), which also underpins e.g. [YAXArrays.jl](https://github.com/JuliaDataCubes/YAXArrays.jl). +# +# In general, any input that works with base Makie will work with GeoMakie in a GeoAxis! + +# First, we'll load Rasters.jl, RasterDataSources.jl which provides access to common datasets, and ArchGDAL.jl which Rasters.jl depends on to read files. using Rasters, RasterDataSources, ArchGDAL +# We'll also load GeoMakie and CairoMakie to plot the data. using GeoMakie, CairoMakie -# +# First, we can load a Raster from the [EarthEnv](earthenv.org) project, which represents habitat or ecosystem heterogeneity. + +ras = Raster(EarthEnv{HabitatHeterogeneity}, :homogeneity) # habitat homogeneity to neighbouring pixel +# Let's take a look at this in regular Makie first: +heatmap(ras; axis = (; aspect = DataAspect())) +# We can plot this in any projection: +fig = Figure(); ga = GeoAxis(fig[1, 1]) +hm = heatmap!(ga, ras) +fig +# We can also change the projection arbitrarily: +ga.dest[] = "+proj=ortho +lon_0=19 +lat_0=72" +fig +# and all other Makie keyword arguments also apply! +hm.colormap = :isoluminant_cgo_70_c39_n256 +fig +# You can also use other recipes like surface: +fig = Figure(); ga = GeoAxis(fig[1, 1]) +sp = surface!(ga, ras) +fig +# This looks a bit strange - but you can always disable shading: +sp.shading = NoShading +fig +# See also the Geostationary image and Multiple CRS examples, where we explore how to plot data in different projections. # make cover image #jl mkpath("covers") #hide save("covers/$(splitext(basename(@__FILE__))[1]).png", fig) #hide diff --git a/examples/source_crs.jl b/examples/source_crs.jl index de101bf8..ab284084 100644 --- a/examples/source_crs.jl +++ b/examples/source_crs.jl @@ -18,10 +18,6 @@ webmerc_geojson = GO.reproject(GI.convert.((GI,), geojson) |> GO.tuples; transfo london = Rect2d(-0.0921, 51.5, 0.04, 0.025) -function Makie.MakieCore.attribute_name_allowlist() - (:xautolimits, :yautolimits, :zautolimits, :label, :rasterize, :model, :transformation, :dest, :source, :specular, :matcap, :backlight, :shininess, :interpolate, :diffuse,:dim_conversions) -end - fig = Figure() nax = Axis(fig[1, 1]; aspect = DataAspect()) m = Tyler.Map(london, figure = fig, axis = nax)