Skip to content

Plotting empty MultiLineString is broken #97

@simeonschaub

Description

@simeonschaub

Not sure if this is the right repo, but the following code errors:

julia> using GeoMakie, CairoMakie, GeoJSON

julia> lines(GeoJSON.MultiLineString(; coordinates = Vector{Tuple{Float32, Float32}}[]))
[...]

julia> show(err)
1-element ExceptionStack:
MethodError: no method matching GeometryBasics.MultiLineString(::Vector{Any})
The type `GeometryBasics.MultiLineString` exists, but no method is defined for this combination of argument types when trying to construct it.

Closest candidates are:
  GeometryBasics.MultiLineString(::A) where {Dim, T<:Real, Element<:(GeometryBasics.LineString{Dim, T, P, V} where {P<:GeometryBasics.AbstractPoint, V<:(AbstractVector{<:GeometryBasics.Ngon{Dim, T, 2, P}})}), A<:AbstractVector{Element}}
   @ GeometryBasics ~/.julia/packages/GeometryBasics/ebXl0/src/basic_types.jl:331
  GeometryBasics.MultiLineString(::AbstractVector{L}; kw...) where {Dim, T, P, L<:AbstractArray{GeometryBasics.Ngon{Dim, T, 2, P}, 1}}
   @ GeometryBasics ~/.julia/packages/GeometryBasics/ebXl0/src/basic_types.jl:334

Stacktrace:
  [1] convert(::Type{GeometryBasics.MultiLineString}, type::GeoInterface.MultiLineStringTrait, geom::GeoJSON.MultiLineString{2, Float32})
    @ GeometryBasics ~/.julia/packages/GeometryBasics/ebXl0/src/geointerface.jl:145
  [2] convert(package::Module, geom::GeoJSON.MultiLineString{2, Float32})
    @ GeoInterface ~/.julia/packages/GeoInterface/4tyIo/src/fallbacks.jl:152
  [3] _convert_arguments(t::Type, geom::GeoJSON.MultiLineString{2, Float32})
    @ GeoInterfaceMakie ~/.julia/packages/GeoInterfaceMakie/vxpgB/src/GeoInterfaceMakie.jl:23
  [4] #convert_arguments#7
    @ ~/.julia/packages/GeoInterfaceMakie/vxpgB/src/GeoInterfaceMakie.jl:109 [inlined]
  [5] convert_arguments(p::Type{Lines}, geom::GeoJSON.MultiLineString{2, Float32})
    @ GeoJSONMakieExt ~/.julia/packages/GeoInterfaceMakie/vxpgB/src/GeoInterfaceMakie.jl:108
  [6] conversion_pipeline(P::Type{Lines}, used_attrs::Tuple{}, args::Tuple{GeoJSON.MultiLineString{2, Float32}}, kw_obs::Observable{Vector{Pair{Symbol, Any}}}, args_obs::Tuple{Observable{Any}}, user_attributes::Dict{Symbol, Any}, deregister::Vector{Observables.ObserverFunction}, recursion::Int64)
    @ Makie ~/.julia/packages/Makie/Y3ABD/src/interfaces.jl:227
  [7] conversion_pipeline(P::Type{Lines}, used_attrs::Tuple{}, args::Tuple{GeoJSON.MultiLineString{2, Float32}}, kw_obs::Observable{Vector{Pair{Symbol, Any}}}, args_obs::Tuple{Observable{Any}}, user_attributes::Dict{Symbol, Any}, deregister::Vector{Observables.ObserverFunction})
    @ Makie ~/.julia/packages/Makie/Y3ABD/src/interfaces.jl:218
  [8] (Lines)(user_args::Tuple{GeoJSON.MultiLineString{2, Float32}}, user_attributes::Dict{Symbol, Any})
    @ Makie ~/.julia/packages/Makie/Y3ABD/src/interfaces.jl:278
  [9] _create_plot(F::Function, attributes::Dict{Symbol, Any}, args::GeoJSON.MultiLineString{2, Float32})
    @ Makie ~/.julia/packages/Makie/Y3ABD/src/figureplotting.jl:316
 [10] #lines#48
    @ ~/.julia/packages/MakieCore/EU17Y/src/recipes.jl:510 [inlined]
 [11] lines(args::GeoJSON.MultiLineString{2, Float32})
    @ MakieCore ~/.julia/packages/MakieCore/EU17Y/src/recipes.jl:508
 [12] top-level scope
    @ REPL[4]:1

Encountered when trying to plot NaturalEarth.naturalearth("rivers_lake_centerlines", 50)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions