From 476adde5b8f65d76636636fd6305975cbc0f58d4 Mon Sep 17 00:00:00 2001 From: Rafael Schouten Date: Sun, 7 Jan 2024 13:41:47 +0100 Subject: [PATCH] add Makie extension (#84) * add Makie extension * fixes * fix Aqua * better extension name * test fixes * fix Aqua * import GeoInterfaceRecipes in tests * remove show * stop supporting < 1.9 * a typeo --- .github/workflows/CI.yml | 2 +- .github/workflows/Documentation.yml | 2 +- Project.toml | 14 ++++++++++++-- ext/GeoJSONMakieExt.jl | 7 +++++++ test/runtests.jl | 19 +++++++++++++++---- 5 files changed, 36 insertions(+), 8 deletions(-) create mode 100644 ext/GeoJSONMakieExt.jl diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 095b6c3..c709dc1 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: version: - - '1.6' + - '1.9' - '1' - 'nightly' os: diff --git a/.github/workflows/Documentation.yml b/.github/workflows/Documentation.yml index fcb17c4..573b6db 100644 --- a/.github/workflows/Documentation.yml +++ b/.github/workflows/Documentation.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v1 with: - version: '1.6' + version: '1.9' - name: Install dependencies run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()' - name: Build and deploy diff --git a/Project.toml b/Project.toml index dbeacc8..3bf53d8 100644 --- a/Project.toml +++ b/Project.toml @@ -7,6 +7,7 @@ version = "0.7.3" Extents = "411431e0-e8b7-467b-b5e0-f676ba4f2910" GeoFormatTypes = "68eda718-8dee-11e9-39e7-89f7f65f511f" GeoInterface = "cf35fbd7-0cd7-5166-be24-54bfbe79505f" +GeoInterfaceMakie = "0edc0954-3250-4c18-859d-ec71c1660c08" GeoInterfaceRecipes = "0329782f-3d07-4b52-b9f6-d3137cf03c7a" JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1" StructTypes = "856f2bd8-1eba-4b0a-8007-ebc267875bd4" @@ -18,19 +19,28 @@ DataFrames = "1.6" Extents = "0.1" GeoFormatTypes = "0.4" GeoInterface = "1.2.1" +GeoInterfaceMakie = "0.1" GeoInterfaceRecipes = "1" JSON3 = "1.13" +Makie = "0.20" Plots = "1.39" StructTypes = "1" Tables = "1" Test = "<0.0.1,1" -julia = "1.6" +julia = "1.9" + +[weakdeps] +Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" + +[extensions] +GeoJSONMakieExt = "Makie" [extras] Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" +Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["Aqua", "DataFrames", "Plots", "Test"] +test = ["Aqua", "DataFrames", "Makie", "Plots", "Test"] diff --git a/ext/GeoJSONMakieExt.jl b/ext/GeoJSONMakieExt.jl new file mode 100644 index 0000000..1e33a40 --- /dev/null +++ b/ext/GeoJSONMakieExt.jl @@ -0,0 +1,7 @@ +module GeoJSONMakieExt +using GeoInterfaceMakie: GeoInterfaceMakie +using GeoJSON: GeoJSON + +GeoInterfaceMakie.@enable GeoJSON.AbstractGeometry + +end diff --git a/test/runtests.jl b/test/runtests.jl index cfbfa0e..c864d86 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,5 +1,6 @@ using GeoJSON import GeoInterface as GI +import GeoInterfaceRecipes import GeoFormatTypes import Aqua using Extents @@ -7,11 +8,19 @@ using JSON3 using Tables using Test using Plots +using Makie using DataFrames include("geojson_samples.jl") @testset "GeoJSON" begin + @testset "Aqua.jl" begin + Aqua.test_all( + GeoJSON; + ambiguities=(exclude=[GeoInterfaceRecipes.RecipesBase.apply_recipe],), + stale_deps=(ignore=[:GeoInterfaceMakie],), + ) + end @testset "Features" begin geometries = [ @@ -47,7 +56,8 @@ include("geojson_samples.jl") geom = GeoJSON.geometry(GeoJSON.read(s)) if !isnothing(geom) @test GeoJSON.coordinates(geom) == g - plot(geom) + Plots.plot(geom) + Makie.plot(geom) end end end @@ -65,9 +75,12 @@ include("geojson_samples.jl") (-170.0f0, 40.0f0), ]], ] + Plots.plot(geom) + Makie.plot(geom) geom = GeoJSON.read(Samples.bbox) - plot(geom) + Plots.plot(geom) + Makie.plot(geom) @test geom isa GeoJSON.LineString @test GI.crs(geom) == GeoFormatTypes.EPSG(4326) @test GeoJSON.coordinates(geom) == [(-35.1f0, -6.6f0), (8.1f0, 3.8f0)] @@ -363,6 +376,4 @@ include("geojson_samples.jl") "{\"type\":\"Point\",\"coordinates\":[1.0,2.0,3]}" end - Aqua.test_all(GeoJSON) - end # testset "GeoJSON"