Skip to content

add Makie extension #84

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1.6'
- '1.9'
- '1'
- 'nightly'
os:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 12 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"]
7 changes: 7 additions & 0 deletions ext/GeoJSONMakieExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module GeoJSONMakieExt
using GeoInterfaceMakie: GeoInterfaceMakie
using GeoJSON: GeoJSON

GeoInterfaceMakie.@enable GeoJSON.AbstractGeometry

end
19 changes: 15 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
using GeoJSON
import GeoInterface as GI
import GeoInterfaceRecipes
import GeoFormatTypes
import Aqua
using Extents
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 = [
Expand Down Expand Up @@ -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
Expand All @@ -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)]
Expand Down Expand Up @@ -363,6 +376,4 @@ include("geojson_samples.jl")
"{\"type\":\"Point\",\"coordinates\":[1.0,2.0,3]}"
end

Aqua.test_all(GeoJSON)

end # testset "GeoJSON"