Skip to content
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

add Makie extension #189

Merged
merged 10 commits into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from 8 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
18 changes: 16 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,34 @@ CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"
Extents = "411431e0-e8b7-467b-b5e0-f676ba4f2910"
GEOS_jll = "d604d12d-fa86-5845-992e-78dc15976526"
GeoInterface = "cf35fbd7-0cd7-5166-be24-54bfbe79505f"
GeoInterfaceMakie = "0edc0954-3250-4c18-859d-ec71c1660c08"
GeoInterfaceRecipes = "0329782f-3d07-4b52-b9f6-d3137cf03c7a"
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"

[weakdeps]
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"

[extensions]
LibGEOSMakieExt = "Makie"

[compat]
Aqua = "0.8"
CEnum = "0.2, 0.3, 0.4, 0.5"
Extents = "0.1.1"
GEOS_jll = "3.12"
GeoInterface = "1"
GeoInterfaceMakie = "0.1"
GeoInterfaceRecipes = "1"
julia = "1.6"
Makie = "0.20"
Plots = "1"
Test = "<0.0.1,1"
julia = "1.9"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Aqua", "Plots", "Test"]
test = ["Aqua", "Makie", "Plots", "Test"]
7 changes: 7 additions & 0 deletions ext/LibGEOSMakieExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module LibGEOSMakieExt
using GeoInterfaceMakie: GeoInterfaceMakie
using LibGEOS: LibGEOS

GeoInterfaceMakie.@enable LibGEOS.AbstractGeometry

end
10 changes: 8 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using GeoInterface, Extents
using GeoInterface, GeoInterfaceRecipes, Extents
using Test, LibGEOS
import Aqua

Expand All @@ -14,6 +14,13 @@ if version != LibGEOS.GEOS_CAPI_VERSION
end

@testset "LibGEOS" begin
@testset "Aqua.jl" begin
Aqua.test_all(
LibGEOS;
ambiguities=(exclude=[GeoInterfaceRecipes.RecipesBase.apply_recipe],),
stale_deps=(ignore=[:GeoInterfaceMakie],),
)
end
include("test_geos_types.jl")
include("test_geos_functions.jl")
include("test_geos_operations.jl")
Expand All @@ -22,5 +29,4 @@ end
include("test_invalid_geometry.jl")
include("test_strtree.jl")
include("test_misc.jl")
Aqua.test_all(LibGEOS)
end
31 changes: 21 additions & 10 deletions test/test_geo_interface.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Test, Plots, GeoInterface, LibGEOS, Extents
using Test, Makie, Plots, GeoInterface, LibGEOS, Extents
const GI = GeoInterface
const LG = LibGEOS

Expand All @@ -12,7 +12,8 @@ const LG = LibGEOS
@test GeoInterface.getcoord(pt, 1) ≈ 1.0
@test GeoInterface.testgeometry(pt)
@test GeoInterface.extent(pt) == Extent(X=(1.0, 1.0), Y=(2.0, 2.0))
plot(pt)
Plots.plot(pt)
Makie.plot(pt)

pt = LibGEOS.Point(1.0, 2.0, 3.0)
@test GeoInterface.x(pt) == 1.0
Expand All @@ -25,7 +26,9 @@ const LG = LibGEOS
# This doesn't return the Z extent
@test_broken GeoInterface.extent(pt) ==
Extent(X = (1.0, 1.0), Y = (2.0, 2.0), Z = (3.0, 3.0))
plot(pt)
Plots.plot(pt)
Makie.plot(pt)
Makie.plot(pt)

pt = LibGEOS.Point(1, 2)
@test GeoInterface.coordinates(pt) ≈ [1, 2] atol = 1e-5
Expand All @@ -52,7 +55,8 @@ const LG = LibGEOS
@test p isa LibGEOS.Point
@test GeoInterface.coordinates(p) == [10, 0]
@test GeoInterface.testgeometry(mpt)
plot(mpt)
Plots.plot(mpt)
Makie.plot(mpt)

@inferred GeoInterface.ncoord(mpt)
@inferred GeoInterface.ngeom(mpt)
Expand All @@ -68,7 +72,8 @@ const LG = LibGEOS
@test p isa LibGEOS.Point
@test GeoInterface.coordinates(p) == [9, 2]
@test GeoInterface.testgeometry(ls)
plot(ls)
Plots.plot(ls)
Makie.plot(ls)

@inferred GeoInterface.ncoord(ls)
@inferred GeoInterface.ngeom(ls)
Expand All @@ -85,7 +90,8 @@ const LG = LibGEOS
@test GeoInterface.geomtrait(mls) == MultiLineStringTrait()
@test GeoInterface.ngeom(mls) == 2
@test GeoInterface.testgeometry(mls)
plot(mls)
Plots.plot(mls)
Makie.plot(mls)

@inferred GeoInterface.ncoord(mls)
@inferred GeoInterface.ngeom(mls)
Expand All @@ -102,7 +108,8 @@ const LG = LibGEOS
@test GeoInterface.coordinates(p) == [9, 2]
@test GeoInterface.testgeometry(lr)
# Cannot convert LinearRingTrait to series data for plotting
# plot(lr)
# Plots.plot(lr)
# Makie.plot(lr)

@inferred GeoInterface.ncoord(lr)
@inferred GeoInterface.ngeom(lr)
Expand All @@ -122,7 +129,8 @@ const LG = LibGEOS
@test ls isa LibGEOS.LinearRing
@test GeoInterface.coordinates(ls) == coords[2]
@test GeoInterface.testgeometry(polygon)
plot(polygon)
Plots.plot(polygon)
Makie.plot(polygon)

@inferred GeoInterface.ncoord(polygon)
@inferred GeoInterface.ngeom(polygon)
Expand All @@ -146,7 +154,8 @@ const LG = LibGEOS
@test GeoInterface.geomtrait(multipolygon) == MultiPolygonTrait()
@test GeoInterface.testgeometry(multipolygon)
@test GeoInterface.extent(multipolygon) == Extent(X=(0.0, 10.0), Y=(0.0, 10.0))
plot(multipolygon)
Plots.plot(multipolygon)
Makie.plot(multipolygon)

@inferred GeoInterface.ncoord(multipolygon)
@inferred GeoInterface.ngeom(multipolygon)
Expand Down Expand Up @@ -229,7 +238,9 @@ const LG = LibGEOS
end
@test GeoInterface.geomtrait(geomcollection) == GeometryCollectionTrait()
@test GeoInterface.testgeometry(geomcollection)
plot(geomcollection)
Plots.plot(geomcollection)
# Can't plot geometry collection yet with Makie
@test_broken Makie.plot(geomcollection)

@inferred GeoInterface.ncoord(geomcollection)
@inferred GeoInterface.ngeom(geomcollection)
Expand Down