From 8574aba298c76a42b4e22a3554b56f1c1367cde6 Mon Sep 17 00:00:00 2001 From: gaelforget Date: Sun, 15 Sep 2024 06:51:03 -0400 Subject: [PATCH 1/3] fix/update GeoJSON example --- ext/MeshArraysMakieExt.jl | 9 +++++---- test/runtests.jl | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ext/MeshArraysMakieExt.jl b/ext/MeshArraysMakieExt.jl index 66ba1c2..36e558d 100644 --- a/ext/MeshArraysMakieExt.jl +++ b/ext/MeshArraysMakieExt.jl @@ -467,11 +467,11 @@ function json_to_Makie(file="countries.geojson") tmp22=Vector{Point2{Float64}}[] for l1 in tmp2 - if isa(l1[1][1],Vector{Float64}) - push!(tmp22,geo2basic(l1[1])) + if isa(l1[1][1],Tuple) + push!(tmp22,geo2basic(tuple2vec.(l1[1]))) else for l2 in l1 - push!(tmp22,geo2basic(l2[1])) + push!(tmp22,geo2basic(tuple2vec.(l2[1]))) end end end @@ -479,6 +479,8 @@ function json_to_Makie(file="countries.geojson") LineString.(tmp22) end +tuple2vec(x)=[y for y in x] + """ shp_to_Makie(file="countries.geojson") @@ -520,7 +522,6 @@ function geo2basic(vector::AbstractVector{<:AbstractVector}) end end - ## """ diff --git a/test/runtests.jl b/test/runtests.jl index 74a5624..2ca3449 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -218,8 +218,8 @@ end proj=Proj.Transformation(MA_preset=2,lon0=lon0) Dint=reshape(Interpolate(D,λ.f,λ.i,λ.j,λ.w),size(λ.lon)) -# fil=demo.download_polygons("countries.geojson") -# pol=MeshArrays.read_polygons(fil) + fil=demo.download_polygons("countries.geojson") + pol=MeshArrays.read_polygons(fil) fil=demo.download_polygons("ne_110m_admin_0_countries.shp") pol=MeshArrays.read_polygons(fil) From 34031e4c8a37ee25e8738a30303d600bf6a8802f Mon Sep 17 00:00:00 2001 From: gaelforget Date: Sun, 15 Sep 2024 07:26:19 -0400 Subject: [PATCH 2/3] increase codecov --- test/runtests.jl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/runtests.jl b/test/runtests.jl index 2ca3449..cf6e65b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -218,9 +218,20 @@ end proj=Proj.Transformation(MA_preset=2,lon0=lon0) Dint=reshape(Interpolate(D,λ.f,λ.i,λ.j,λ.w),size(λ.lon)) + ### + fil=demo.download_polygons("countries.geojson") pol=MeshArrays.read_polygons(fil) + MeshArraysMakieExt = Base.get_extension(MeshArrays, :MeshArraysMakieExt) + dest="+proj=eqearth +lon_0=$(lon0) +lat_1=0.0 +x_0=0.0 +y_0=0.0 +ellps=GRS80" + MeshArraysMakieExt.split(pol,dest) + MeshArraysMakieExt.split(pol,Observable(dest)) + MeshArraysMakieExt.split(Observable(pol),Observable(dest)) + MeshArraysMakieExt.split(Observable(pol),dest) + + ### + fil=demo.download_polygons("ne_110m_admin_0_countries.shp") pol=MeshArrays.read_polygons(fil) From 48634b46980d5c12938fb0b5c07e0703588828ad Mon Sep 17 00:00:00 2001 From: gaelforget Date: Sun, 15 Sep 2024 07:33:53 -0400 Subject: [PATCH 3/3] increase codecov --- test/runtests.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/test/runtests.jl b/test/runtests.jl index cf6e65b..dc9ff6f 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -247,6 +247,7 @@ end meta=(colorrange=(0.0,6000.0),cmap=:BrBG_10,ttl="Ocean Depth (m)",lon0=lon0) data=(lon=λ.lon,lat=λ.lat,var=Dint,meta=meta) #,polygons=pol) plot_examples(:projmap,data,lon0,proj) + plot_examples(:simple_heatmap,data) end