### Geomakie.jl GMT Examples Source: https://github.com/makieorg/geomakie.jl/blob/master/docs/src/examples.md Presents an example inspired by the Generic Mapping Tools (GMT), specifically the Antioquia region visualization. ```julia using Geomakie # Example: Antioquia # makie(antioquia) ``` -------------------------------- ### Install GeoMakie.jl Source: https://github.com/makieorg/geomakie.jl/blob/master/docs/src/introduction.md Installs the GeoMakie.jl package from the Julia REPL. ```julia ] add GeoMakie ``` -------------------------------- ### Install GeoMakie Source: https://github.com/makieorg/geomakie.jl/blob/master/README.md Instructions for installing the GeoMakie package using the Julia package manager. ```julia ] add GeoMakie ``` -------------------------------- ### Geomakie.jl Cartopy Examples Source: https://github.com/makieorg/geomakie.jl/blob/master/docs/src/examples.md Illustrates examples inspired by Cartopy, including annotations, arrows, and streamplots, showcasing geographical data visualization techniques. ```julia using Geomakie # Example: Annotation # makie(annotation) # Example: Arrows # makie(arrows) # Example: Katrina # makie(katrina) # Example: Streamplot # makie(streamplot) ``` -------------------------------- ### Card Metadata Block Source: https://github.com/makieorg/geomakie.jl/blob/master/docs/src/adding_demos.md This Julia code block demonstrates how to define metadata for an example using the `@cardmeta` Documenter.jl block. It specifies the cover image, a description, and an optional title for the example card. This metadata is crucial for generating the example gallery. ```julia #= ```@cardmeta Cover = fig Description = "A very short description of the example" Title = "Some title, optional" ``` =# ``` -------------------------------- ### GeoMakie Quick Start Source: https://github.com/makieorg/geomakie.jl/blob/master/docs/src/index.md Demonstrates the basic usage of GeoMakie.jl, including creating a `GeoAxis`, plotting coastlines, and scattering data points with automatic CRS transformation. ```julia using CairoMakie, GeoMakie 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 ) lines!(ga, GeoMakie.coastlines()) # plot coastlines from Natural Earth as a reference # You can plot your data the same way you would in Makie scatter!(ga, -120:15:120, -60:7.5:60; color = -60:7.5:60, strokecolor = (:black, 0.2)) fig ``` -------------------------------- ### Setup for Nonlinear Transformations Source: https://github.com/makieorg/geomakie.jl/blob/master/docs/src/nonlinear_transforms.md Imports necessary libraries (Makie, GeoMakie, FileIO) for working with nonlinear transformations and plotting. ```julia using Makie, GeoMakie using Makie.FileIO ``` -------------------------------- ### Geomakie.jl Basic Examples Source: https://github.com/makieorg/geomakie.jl/blob/master/docs/src/examples.md Showcases fundamental functionalities of Geomakie.jl, including Italy, field and countries, rotating earth, histogram, contours, rasters, multiple CRS, and basic overview gallery. ```julia using Geomakie # Example: Basic overview gallery # This would typically involve plotting some geographical data. # For instance, plotting a map of Italy: # makie(Italy) # Example: Field and Countries # makie(field_and_countries) # Example: Rotating Earth # makie(rotating_earth) # Example: Histogram # makie(histogram) # Example: Contours # makie(contours) # Example: Rasters # makie(rasters) # Example: Multiple CRS # makie(multiple_crs) ``` -------------------------------- ### Map Projection Example (Wintri) Source: https://github.com/makieorg/geomakie.jl/blob/master/docs/src/introduction.md Shows how to change the map projection used by GeoAxis. This example sets the destination projection to 'wintri' for a different map visualization. ```julia using GeoMakie, CairoMakie lons = -180:180 lats = -90:90 field = [exp(cosd(l)) + 3(y/90) for l in lons, y in lats] fig = Figure() ax = GeoAxis(fig[1,1]; dest = "+proj=wintri") surface!(ax, lons, lats, field; shading = NoShading) fig ``` -------------------------------- ### Geomakie.jl Advanced Functionality Examples Source: https://github.com/makieorg/geomakie.jl/blob/master/docs/src/examples.md Demonstrates advanced features of Geomakie.jl, such as axis configuration, world population visualization, graph plotting on USA, orthographic projections, geostationary images, plane detection, German lakes, mesh images, Tissot's indicatrices, and HEALPix maps. ```julia using Geomakie # Example: Axis Configuration # makie(axis_config) # Example: World Population # makie(world_population) # Example: Graph on USA # makie(graph_on_usa) # Example: Orthographic Projection # makie(orthographic) # Example: Geostationary Image # makie(geostationary_image) # Example: Is it a plane? # makie(is_it_a_plane) # Example: German Lakes # makie(german_lakes) # Example: Mesh Image # makie(meshimage) # Example: Projections # makie(projections) # Example: Tissot's Indicatrices # makie(tissot) # Example: HEALPix # makie(healpix) ``` -------------------------------- ### Surface Plot Example Source: https://github.com/makieorg/geomakie.jl/blob/master/docs/src/introduction.md Demonstrates creating a surface plot with GeoMakie.jl using sample latitude, longitude, and field data. It utilizes GeoAxis for geospatial plotting and CairoMakie for rendering. ```julia using GeoMakie, CairoMakie lons = -180:180 lats = -90:90 field = [exp(cosd(l)) + 3(y/90) for l in lons, y in lats] fig = Figure() ax = GeoAxis(fig[1,1]) surface!(ax, lons, lats, field; shading = NoShading) fig ``` -------------------------------- ### Affine Transformation Example Source: https://github.com/makieorg/geomakie.jl/blob/master/docs/src/nonlinear_transforms.md Demonstrates an affine transformation using `meshimage` with Makie's logo. Affine transformations are linear combinations of translation, scale, and rotation. ```julia meshimage(Makie.logo()) ``` -------------------------------- ### Check GeoMakie Version Source: https://github.com/makieorg/geomakie.jl/blob/master/README.md How to check the installed version of the GeoMakie package in the Julia REPL. ```julia julia> ] pkg> status GeoMakie ``` -------------------------------- ### Diverse GeoMakie Plotting Examples Source: https://github.com/makieorg/geomakie.jl/blob/master/docs/src/index.md Showcases various GeoMakie plotting capabilities, including orthographic and Mollweide projections, plotting images of Earth, polygons, and automatic limit adjustments. ```julia using GeoMakie, CairoMakie 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(size = (1000, 1000)) ga1 = GeoAxis(fig[1, 1]; dest = "+proj=ortho", title = "Orthographic\n "); lines!(ga1, GeoMakie.coastlines()) ga2 = GeoAxis(fig[1, 2]; dest = "+proj=moll", title = "Image of Earth\n ") ga3 = GeoAxis(fig[2, 1]; 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 = NoShading) 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]); ylims!(ga3, (-90, 90)) # you can manipulate the axes as usual for Makie! fig ``` -------------------------------- ### Scatter Plot Example Source: https://github.com/makieorg/geomakie.jl/blob/master/docs/src/introduction.md Illustrates how to create a scatter plot with GeoMakie.jl. It generates random longitude and latitude points, associates them with a field value, and plots them using GeoAxis. ```julia using GeoMakie, CairoMakie lons = -180:180 lats = -90:90 slons = rand(lons, 2000) slats = rand(lats, 2000) sfield = [exp(cosd(l)) + 3(y/90) for (l,y) in zip(slons, slats)] fig = Figure() ax = GeoAxis(fig[1,1]) scatter!(slons, slats; color = sfield) fig ``` -------------------------------- ### Multiple GeoAxis Examples with Different Projections Source: https://github.com/makieorg/geomakie.jl/blob/master/README.md Showcases the use of GeoAxis with various projections like Orthographic, Mollweide, and Natural Earth, plotting different geographic data including images and polygons. ```julia 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(size = (1000, 1000)) ga1 = GeoAxis(fig[1, 1]; dest = "+proj=ortho", title = "Orthographic\n ") ga2 = GeoAxis(fig[1, 2]; dest = "+proj=moll", title = "Image of Earth\n ") ga3 = GeoAxis(fig[2, 1]; 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 = NoShading) lines!(ga1, GeoMakie.coastlines()) 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]); fig ``` -------------------------------- ### Separable Nonlinear Transformation Example Source: https://github.com/makieorg/geomakie.jl/blob/master/docs/src/nonlinear_transforms.md Illustrates a nonlinear but separable transformation using `meshimage` with logarithmic scales on both axes. In these transformations, each coordinate depends only on its corresponding input coordinate. ```julia meshimage( 1..size(Makie.logo(), 2), 1..size(Makie.logo(), 1), Makie.logo(); axis = (; xscale = log, yscale = log10) ) ``` -------------------------------- ### Plotting Countries with GeoJSON Source: https://github.com/makieorg/geomakie.jl/blob/master/docs/src/introduction.md This example demonstrates plotting country boundaries using data from NaturalEarth.jl. It first creates a surface plot and then overlays country polygons with specific styling. ```julia using GeoMakie, CairoMakie using NaturalEarth # First, make a surface plot lons = -180:180 lats = -90:90 field = [exp(cosd(l)) + 3(y/90) for l in lons, y in lats] fig = Figure() ax = GeoAxis(fig[1,1]) sf = surface!(ax, lons, lats, field; shading = NoShading) cb1 = Colorbar(fig[1,2], sf; label = "field", height = Relative(0.65)) countries = naturalearth("admin_0_countries", 110) n = length(countries) hm = poly!(ax, GeoMakie.to_multipoly(countries.geometry); color= 1:n, colormap = :dense, strokecolor = :black, strokewidth = 0.5, ) translate!(hm, 0, 0, 100) # move above surface plot fig ``` -------------------------------- ### Inseparable Nonlinear Transformation Example (Geographic Projection) Source: https://github.com/makieorg/geomakie.jl/blob/master/docs/src/nonlinear_transforms.md Shows an inseparable nonlinear transformation using `meshimage` with a geographic projection (`+proj=igh`). In these transformations, coordinates in the transformed space depend on multiple input coordinates. ```julia meshimage( -180..180, -90..90, Makie.logo(); axis = (; type = GeoAxis, dest = "+proj=igh") ) ``` -------------------------------- ### GeoAxis with Orthographic Projection and Coastlines Source: https://github.com/makieorg/geomakie.jl/blob/master/docs/src/nonlinear_transforms.md Creates a GeoAxis with an orthographic projection and plots coastlines. This example highlights potential issues with bounding boxes in transformed spaces due to coordinate singularities. ```julia # TODO: is failing now fig = Figure() ga = GeoAxis(fig[1, 1]; dest = "+proj=ortho +lon_0=19 +lat_0=50") lines!(ga, GeoMakie.coastlines()) fig ``` -------------------------------- ### Basic GeoAxis Usage with Coastlines and Scatter Plot Source: https://github.com/makieorg/geomakie.jl/blob/master/README.md Demonstrates the creation of a GeoAxis, plotting coastlines, and adding a scatter plot with automatic coordinate transformation. ```julia 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 ) lines!(ga, GeoMakie.coastlines()) # plot coastlines from Natural Earth as a reference # You can plot your data the same way you would in Makie scatter!(ga, -120:15:120, -60:7.5:60; color = -60:7.5:60, strokecolor = (:black, 0.2)) fig ``` -------------------------------- ### Geomakie API Reference Source: https://github.com/makieorg/geomakie.jl/blob/master/docs/src/introduction.md Lists the core functions available in the Geomakie package for geospatial plotting and data manipulation. ```APIDOC GeoMakie.to_multipoly GeoMakie.geo2basic GeoMakie.GeoAxis GeoMakie.geoformat_ticklabels GeoMakie.meshimage ``` -------------------------------- ### Plotting Images with GLMakie Source: https://github.com/makieorg/geomakie.jl/blob/master/docs/src/introduction.md Demonstrates how to plot an image using `surface!` in GLMakie when `image!` or `heatmap!` do not work. It specifies the use of `ones(size(img)...)` for the z-values and `shading = NoShading` for proper image display. ```julia surface!(ga, lonmin..lonmax, latmin..latmax, ones(size(img)...); color = img, shading = NoShading) ``` -------------------------------- ### Plotting Scalar Fields with GLMakie Source: https://github.com/makieorg/geomakie.jl/blob/master/docs/src/introduction.md Shows how to plot a scalar field using `surface!` in GLMakie. The `..` notation for intervals indicates that Makie will automatically sample points for the surface. ```julia surface!(ga, lonmin..lonmax, latmin..latmax, field) ``` -------------------------------- ### Plotting with Central Longitude Shift Source: https://github.com/makieorg/geomakie.jl/blob/master/docs/src/index.md Illustrates how to use the `cshift` function to prepare data for plotting with a specific central longitude, then visualizes it using `GeoAxis` and `surface`. ```julia lons = -180:180 lats = -90:90 field = [exp(cosd(l)) + 3(y/90) for l in lons, y in lats] lon_0 = -160 (lons_shift, field_shift) = cshift(lons, field, lon_0) fig = Figure() ax = GeoAxis(fig[1,1]; dest = "+proj=eqearth +lon_0=$(lon_0)") surface!(ax, lons_shift, lats, field_shift, colormap=:balance) lines!(ax, GeoMakie.coastlines(ax), color=:black, overdraw = true) fig ``` -------------------------------- ### GeoMakie Built-in Data Sources Source: https://github.com/makieorg/geomakie.jl/blob/master/docs/src/data.md Provides access to plottable geographic data from Natural Earth. These functions can be directly passed to Makie plotting functions like `lines`, `poly`, or `image`. ```julia using GeoMakie # Example usage: coastlines() land() earth() ``` -------------------------------- ### Visualizing Valid/Invalid Regions in a Projection Source: https://github.com/makieorg/geomakie.jl/blob/master/docs/src/nonlinear_transforms.md Generates a heatmap to visualize which points are valid (visible) or invalid (invisible) within a specific geographic projection. This helps in understanding bounding box limitations. ```julia lons = LinRange(-180, 180, 500) lats = LinRange(-90, 90, 500) valid_points = [isfinite(Makie.apply_transform(ga.transform_func[], Point2f(lon, lat))) for lon in lons, lat in lats] f, a, p = heatmap( lons, lats, valid_points; axis = (; aspect = DataAspect(), xlabel = "Longitudes", ylabel = "Latitudes") ) Legend(f[2, 1], [PolyElement(color = first(to_colormap(p.colormap[]))), PolyElement(color = last(to_colormap(p.colormap[])))], ["Invalid (invisible)", "Valid (visible)"], tellheight = true, tellwidth = false) f ``` -------------------------------- ### Changing Central Longitude Source: https://github.com/makieorg/geomakie.jl/blob/master/docs/src/introduction.md Demonstrates how to adjust the central longitude of the map projection to handle data that wraps around the globe. This is achieved by modifying the `dest` argument in GeoAxis. ```julia ax = GeoAxis(fig[1,1]; dest = "+proj=eqearth +lon_0=180") ``` -------------------------------- ### Central Longitude Shifting Function Source: https://github.com/makieorg/geomakie.jl/blob/master/docs/src/index.md Provides a Julia function `cshift` to adjust longitude data and associated fields when changing the central longitude of a map projection, preventing wrapping errors. ```julia function cshift(lons, field, lon_0) shift = @. lons - lon_0 > 180 nn = sum(shift) (circshift(lons - 360shift, nn), circshift(field, (nn, 0))) end ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.