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

polygonize example in docs need fix #249

Open
gaelforget opened this issue Jan 11, 2025 · 4 comments · May be fixed by #250
Open

polygonize example in docs need fix #249

gaelforget opened this issue Jan 11, 2025 · 4 comments · May be fixed by #250

Comments

@gaelforget
Copy link

gaelforget commented Jan 11, 2025

This example : https://juliageo.org/GeometryOps.jl/stable/source/methods/polygonize#Polygonizing-raster-data

This line :

f, a, p = poly(polygons; label = "Polygonized polygons", axis = (; aspect = DataAspect()))

Gives this error :

No recipe for poly with args: Tuple{GeoInterface.Wrappers.MultiPolygon{false, false, Vector{GeoInterface.Wrappers.Polygon{false, false, Vector{GeoInterface.Wrappers.LinearRing{false, false, Vector{Tuple{Float64, Float64}}, Extents.Extent{(:X, :Y), Tuple{Tuple{Float64, Float64}, Tuple{Float64, Float64}}}, Nothing}}, Extents.Extent{(:X, :Y), Tuple{Tuple{Float64, Float64}, Tuple{Float64, Float64}}}, Nothing}}, Extents.Extent{(:X, :Y), Tuple{Tuple{Float64, Float64}, Tuple{Float64, Float64}}}, Nothing}}

and

Stack trace
Here is what happened, the most recent locations are first:
error(s::String)
from 
[julia → error.jl:35](https://github.com/JuliaLang/julia/tree/8f5b7ca12ad48c6d740e058312fc8cf2bbe67848/base/error.jl#L35)
 
plot!
from 
interfaces.jl:363
connect_plot!(parent::Makie.Scene, plot::MakieCore.Poly{…}) [...show types...](http://localhost:1234/edit?id=878c0440-d004-11ef-23ce-a910af27d550#)
from 
Makie → interfaces.jl:395
 
plot!
from 
interfaces.jl:412
plot!(ax::Makie.Axis, plot::MakieCore.Poly{…}) [...show types...](http://localhost:1234/edit?id=878c0440-d004-11ef-23ce-a910af27d550#)
from 
Makie → figureplotting.jl:412
 
plot!(fa::Makie.FigureAxis, plot::MakieCore.Poly{…}) [...show types...](http://localhost:1234/edit?id=878c0440-d004-11ef-23ce-a910af27d550#)
from 
Makie → figureplotting.jl:407
 
_create_plot(F::Function, attributes::Dict{…}, args::GeoInterface.Wrappers.MultiPolygon{…}) [...show types...](http://localhost:1234/edit?id=878c0440-d004-11ef-23ce-a910af27d550#)
from 
Makie → figureplotting.jl:318
 
#poly#64
from 
recipes.jl:510
poly
from 
recipes.jl:508
from 
[This cell: line 2](http://localhost:1234/edit?id=878c0440-d004-11ef-23ce-a910af27d550#cbc99f37-3847-4c43-abcd-c43ae080fe45)

with :

  [13f3f980] CairoMakie v0.12.18
  [cf35fbd7] GeoInterface v1.4.0
  [3251bfac] GeometryOps v0.1.13
  [ee78f7c6] Makie v0.21.18
  [44cfe95a] Pkg v1.11.0
@gaelforget
Copy link
Author

This seems to help :

f, a, p = poly(collect(GI.getpoint(polygons)))

@rafaqz
Copy link
Member

rafaqz commented Jan 11, 2025

It just needs using GeoInterfaceMakie added at the top.

We are in the annoying situation where Makie depends on GeoInterface so we can make an extension to add plot recipes

@gaelforget
Copy link
Author

It just needs using GeoInterfaceMakie added at the top.

We are in the annoying situation where Makie depends on GeoInterface so we can make an extension to add plot recipes

Thanks! This fixed it.

Happy send a PR adding GeoInterfaceMakie @

using Makie, GeometryOps
if you'd like

Maybe there should also be using CairoMakie cause otherwise the plot does not get visualized (instead it returns Figure())

Should I do that?

@rafaqz
Copy link
Member

rafaqz commented Jan 11, 2025

Yes that would be great

@gaelforget gaelforget linked a pull request Jan 11, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants