Skip to content

Commit e58a9cb

Browse files
authored
add Makie extension (#189)
* add Makie extension * tweak * fix deps versions * actually add the extension * better extension name * test fixes * fix Aqua again * stop supporting < 1.9 * remove dup makie dep
1 parent 350152f commit e58a9cb

File tree

5 files changed

+58
-19
lines changed

5 files changed

+58
-19
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
version:
16-
- '1.6'
16+
- '1.9'
1717
- '1'
1818
- 'nightly'
1919
os:

Project.toml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,35 @@ CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"
88
Extents = "411431e0-e8b7-467b-b5e0-f676ba4f2910"
99
GEOS_jll = "d604d12d-fa86-5845-992e-78dc15976526"
1010
GeoInterface = "cf35fbd7-0cd7-5166-be24-54bfbe79505f"
11+
GeoInterfaceMakie = "0edc0954-3250-4c18-859d-ec71c1660c08"
1112
GeoInterfaceRecipes = "0329782f-3d07-4b52-b9f6-d3137cf03c7a"
1213

14+
[weakdeps]
15+
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
16+
17+
[extensions]
18+
LibGEOSMakieExt = "Makie"
19+
1320
[compat]
1421
Aqua = "0.8"
1522
CEnum = "0.2, 0.3, 0.4, 0.5"
1623
Extents = "0.1.1"
1724
GEOS_jll = "3.12"
1825
GeoInterface = "1"
26+
GeoInterfaceMakie = "0.1"
1927
GeoInterfaceRecipes = "1"
28+
Makie = "0.20"
2029
Plots = "1"
2130
RecipesBase = "1"
22-
Test = "1"
23-
julia = "1.6"
31+
Test = "<0.0.1,1"
32+
julia = "1.9"
2433

2534
[extras]
2635
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
36+
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
2737
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
2838
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
2939
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
3040

3141
[targets]
32-
test = ["Aqua", "Plots", "RecipesBase", "Test"]
42+
test = ["Aqua", "Makie", "Plots", "RecipesBase", "Test"]

ext/LibGEOSMakieExt.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module LibGEOSMakieExt
2+
using GeoInterfaceMakie: GeoInterfaceMakie
3+
using LibGEOS: LibGEOS
4+
5+
GeoInterfaceMakie.@enable LibGEOS.AbstractGeometry
6+
7+
end

test/runtests.jl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
21
using GeoInterface, GeoInterfaceRecipes, Extents
32
using GeoInterface, Extents
43
using Test, LibGEOS, RecipesBase
4+
55
import Aqua
66

77
version = LibGEOS.GEOSversion()
@@ -16,9 +16,14 @@ if version != LibGEOS.GEOS_CAPI_VERSION
1616
end
1717

1818
@testset "LibGEOS" begin
19-
Aqua.test_all(LibGEOS;
20-
ambiguities=(exclude=[RecipesBase.apply_recipe],),
21-
)
19+
@testset "Aqua.jl" begin
20+
Aqua.test_all(
21+
LibGEOS;
22+
ambiguities=(exclude=[GeoInterfaceRecipes.RecipesBase.apply_recipe],),
23+
stale_deps=(ignore=[:GeoInterfaceMakie],),
24+
)
25+
end
26+
2227
include("test_geos_types.jl")
2328
include("test_geos_functions.jl")
2429
include("test_geos_operations.jl")

test/test_geo_interface.jl

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Test, Plots, GeoInterface, LibGEOS, Extents
1+
using Test, Makie, Plots, GeoInterface, LibGEOS, Extents
22
const GI = GeoInterface
33
const LG = LibGEOS
44

@@ -13,7 +13,8 @@ const LG = LibGEOS
1313
@test GeoInterface.testgeometry(pt)
1414
@test GeoInterface.is3d(pt) == false
1515
@test GeoInterface.extent(pt) == Extent(X=(1.0, 1.0), Y=(2.0, 2.0))
16-
plot(pt)
16+
Plots.plot(pt)
17+
Makie.plot(pt)
1718

1819
pt = LibGEOS.Point(1.0, 2.0, 3.0)
1920
@test GeoInterface.x(pt) == 1.0
@@ -27,7 +28,9 @@ const LG = LibGEOS
2728
# This doesn't return the Z extent
2829
@test_broken GeoInterface.extent(pt) ==
2930
Extent(X = (1.0, 1.0), Y = (2.0, 2.0), Z = (3.0, 3.0))
30-
plot(pt)
31+
Plots.plot(pt)
32+
Makie.plot(pt)
33+
Makie.plot(pt)
3134

3235
pt = LibGEOS.Point(1, 2)
3336
@test GeoInterface.coordinates(pt) [1, 2] atol = 1e-5
@@ -63,7 +66,10 @@ const LG = LibGEOS
6366
@test GeoInterface.coordinates(p) == [10, 0]
6467
@test GeoInterface.testgeometry(mpt)
6568
@test GeoInterface.is3d(mpt) == false
66-
plot(mpt)
69+
Plots.plot(mpt)
70+
Makie.plot(mpt)
71+
72+
6773

6874
@inferred GeoInterface.ncoord(mpt)
6975
@inferred GeoInterface.ngeom(mpt)
@@ -78,10 +84,12 @@ const LG = LibGEOS
7884
p = GeoInterface.getgeom(ls, 3)
7985
@test p isa LibGEOS.Point
8086
@test GeoInterface.coordinates(p) == [9, 2]
81-
@test GeoInterface.testgeometry(ls)
87+
@test GeoInterface.testgeometry(ls)
8288
@test GeoInterface.is3d(ls) == false
83-
plot(ls)
89+
Plots.plot(ls)
90+
Makie.plot(ls)
8491

92+
8593
@inferred GeoInterface.ncoord(ls)
8694
@inferred GeoInterface.ngeom(ls)
8795
@inferred GeoInterface.getgeom(ls)
@@ -98,7 +106,9 @@ const LG = LibGEOS
98106
@test GeoInterface.ngeom(mls) == 2
99107
@test GeoInterface.testgeometry(mls)
100108
@test GeoInterface.is3d(mls) == false
101-
plot(mls)
109+
Plots.plot(mls)
110+
Makie.plot(mls)
111+
102112

103113
@inferred GeoInterface.ncoord(mls)
104114
@inferred GeoInterface.ngeom(mls)
@@ -116,7 +126,8 @@ const LG = LibGEOS
116126
@test GeoInterface.is3d(lr) == false
117127
@test GeoInterface.testgeometry(lr)
118128
# Cannot convert LinearRingTrait to series data for plotting
119-
# plot(lr)
129+
# Plots.plot(lr)
130+
# Makie.plot(lr)
120131

121132
@inferred GeoInterface.ncoord(lr)
122133
@inferred GeoInterface.ngeom(lr)
@@ -137,7 +148,9 @@ const LG = LibGEOS
137148
@test GeoInterface.coordinates(ls) == coords[2]
138149
@test GeoInterface.testgeometry(polygon)
139150
@test GeoInterface.is3d(polygon) == false
140-
plot(polygon)
151+
Plots.plot(polygon)
152+
Makie.plot(polygon)
153+
141154

142155
@inferred GeoInterface.ncoord(polygon)
143156
@inferred GeoInterface.ngeom(polygon)
@@ -162,7 +175,8 @@ const LG = LibGEOS
162175
@test GeoInterface.testgeometry(multipolygon)
163176
@test GeoInterface.is3d(multipolygon) == false
164177
@test GeoInterface.extent(multipolygon) == Extent(X=(0.0, 10.0), Y=(0.0, 10.0))
165-
plot(multipolygon)
178+
Plots.plot(multipolygon)
179+
Makie.plot(multipolygon)
166180

167181
@inferred GeoInterface.ncoord(multipolygon)
168182
@inferred GeoInterface.ngeom(multipolygon)
@@ -247,7 +261,10 @@ const LG = LibGEOS
247261
@test GeoInterface.geomtrait(geomcollection) == GeometryCollectionTrait()
248262
@test GeoInterface.testgeometry(geomcollection)
249263
@test GeoInterface.is3d(geomcollection) == false
250-
plot(geomcollection)
264+
Plots.plot(geomcollection)
265+
# Can't plot geometry collection yet with Makie
266+
@test_broken Makie.plot(geomcollection)
267+
251268

252269
@inferred GeoInterface.ncoord(geomcollection)
253270
@inferred GeoInterface.ngeom(geomcollection)

0 commit comments

Comments
 (0)