Hello, I’m trying to make map of administrative regions in GeoMakie but the poly!
function does not work with Polygons, unlike specified in the documentation (poly · Makie). Here’s a MWE:
GeoJSON.write("data/DE_regions.geojson", GeoJSON.read(read(download("https://raw.githubusercontent.com/isellsoap/deutschlandGeoJSON/main/2_bundeslaender/1_sehr_hoch.geo.json"))))
landers = copy(GeoJSON.read(read("data/DE_regions.geojson")))
polys = [c.geometry for c in landers]
f = Figure();
ax = GeoAxis(f[1,1]; lonlims = (5,20), latlims = (46,56));
for poly in polys
poly!(ax, poly[i] ;strokewidth = 1, strokecolor = :black)
end
The Stacktrace is long, here’s a snippet:
ERROR: `Makie.convert_arguments` for the plot type Scatter and its conversion trait PointBased() was unsuccessful.
The signature that could not be converted was:
::GeoJSON.Polygon{JSON3.Object{Vector{UInt8}, SubArray{UInt64, 1, Vector{UInt64}, Tuple{UnitRange{Int64}}, true}}}
Makie needs to convert all plot input arguments to types that can be consumed by the backends (typically Arrays with Float32 elements).
You can define a method for `Makie.convert_arguments` (a type recipe) for these types or their supertypes to make this set of arguments convertible (See http://docs.makie.org/stable/documentation/recipes/index.html).
Alternatively, you can define `Makie.convert_single_argument` for single arguments which have types that are unknown to Makie but which can be converted to known types and fed back to the conversion pipeline.
[...]
caused by: MethodError: no method matching convert_arguments(::Type{Scatter}, ::GeoJSON.Polygon{JSON3.Object{Vector{UInt8}, SubArray{UInt64, 1, Vector{UInt64}, Tuple{UnitRange{Int64}}, true}}})
Closest candidates are:
convert_arguments(::Union{Type{Any}, Type{<:AbstractPlot}}, ::Union{AbstractVector, IntervalSets.Interval}, ::Distributions.Distribution) at C:\Users\dehaybe\.julia\packages\Makie\Iqcri\src\stats\distributions.jl:21
convert_arguments(::Union{Type{Any}, Type{<:AbstractPlot}}, ::AbstractVector, ::StatsBase.ECDF) at C:\Users\dehaybe\.julia\packages\Makie\Iqcri\src\stats\ecdf.jl:22
convert_arguments(::Union{Type{Any}, Type{<:AbstractPlot}}, ::AbstractVector, ::Function) at C:\Users\dehaybe\.julia\packages\Makie\Iqcri\src\conversions.jl:607
[...]
caused by: MethodError: no method matching convert_arguments(::PointBased, ::GeoJSON.Polygon{JSON3.Object{Vector{UInt8}, SubArray{UInt64, 1, Vector{UInt64}, Tuple{UnitRange{Int64}}, true}}})
Closest candidates are:
convert_arguments(::PointBased, ::AbstractVector, ::AbstractVector, ::AbstractMatrix) at C:\Users\dehaybe\.julia\packages\Makie\Iqcri\src\conversions.jl:112
convert_arguments(::SurfaceLike, ::AbstractVector{T1}, ::AbstractVector{T2}, ::Function) where {T1, T2} at C:\Users\dehaybe\.julia\packages\Makie\Iqcri\src\conversions.jl:403
convert_arguments(::Type{<:Combined{Makie.rainclouds}}, ::Any, ::Any) at C:\Users\dehaybe\.julia\packages\Makie\Iqcri\src\basic_recipes\raincloud.jl:189
I don’t understand why this does not work out of the box. polys
is a Vector of GeoJSON.Geometry
(Polygons and MultiPolygons).
Thanks for any help.