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 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
16 changes: 13 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,35 @@ 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"

[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"
Makie = "0.20"
Plots = "1"
RecipesBase = "1"
Test = "1"
julia = "1.6"
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"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Aqua", "Plots", "RecipesBase", "Test"]
test = ["Aqua", "Makie", "Plots", "RecipesBase", "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
13 changes: 9 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

using GeoInterface, GeoInterfaceRecipes, Extents
using GeoInterface, Extents
using Test, LibGEOS, RecipesBase

import Aqua

version = LibGEOS.GEOSversion()
Expand All @@ -16,9 +16,14 @@ if version != LibGEOS.GEOS_CAPI_VERSION
end

@testset "LibGEOS" begin
Aqua.test_all(LibGEOS;
ambiguities=(exclude=[RecipesBase.apply_recipe],),
)
@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 Down
39 changes: 28 additions & 11 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 @@ -13,7 +13,8 @@ const LG = LibGEOS
@test GeoInterface.testgeometry(pt)
@test GeoInterface.is3d(pt) == false
@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 @@ -27,7 +28,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 Down Expand Up @@ -63,7 +66,10 @@ const LG = LibGEOS
@test GeoInterface.coordinates(p) == [10, 0]
@test GeoInterface.testgeometry(mpt)
@test GeoInterface.is3d(mpt) == false
plot(mpt)
Plots.plot(mpt)
Makie.plot(mpt)



@inferred GeoInterface.ncoord(mpt)
@inferred GeoInterface.ngeom(mpt)
Expand All @@ -78,10 +84,12 @@ const LG = LibGEOS
p = GeoInterface.getgeom(ls, 3)
@test p isa LibGEOS.Point
@test GeoInterface.coordinates(p) == [9, 2]
@test GeoInterface.testgeometry(ls)
@test GeoInterface.testgeometry(ls)
@test GeoInterface.is3d(ls) == false
plot(ls)
Plots.plot(ls)
Makie.plot(ls)


@inferred GeoInterface.ncoord(ls)
@inferred GeoInterface.ngeom(ls)
@inferred GeoInterface.getgeom(ls)
Expand All @@ -98,7 +106,9 @@ const LG = LibGEOS
@test GeoInterface.ngeom(mls) == 2
@test GeoInterface.testgeometry(mls)
@test GeoInterface.is3d(mls) == false
plot(mls)
Plots.plot(mls)
Makie.plot(mls)


@inferred GeoInterface.ncoord(mls)
@inferred GeoInterface.ngeom(mls)
Expand All @@ -116,7 +126,8 @@ const LG = LibGEOS
@test GeoInterface.is3d(lr) == false
@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 @@ -137,7 +148,9 @@ const LG = LibGEOS
@test GeoInterface.coordinates(ls) == coords[2]
@test GeoInterface.testgeometry(polygon)
@test GeoInterface.is3d(polygon) == false
plot(polygon)
Plots.plot(polygon)
Makie.plot(polygon)


@inferred GeoInterface.ncoord(polygon)
@inferred GeoInterface.ngeom(polygon)
Expand All @@ -162,7 +175,8 @@ const LG = LibGEOS
@test GeoInterface.testgeometry(multipolygon)
@test GeoInterface.is3d(multipolygon) == false
@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 @@ -247,7 +261,10 @@ const LG = LibGEOS
@test GeoInterface.geomtrait(geomcollection) == GeometryCollectionTrait()
@test GeoInterface.testgeometry(geomcollection)
@test GeoInterface.is3d(geomcollection) == false
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