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

ArchGDAL.Feature unable to be shown in Pluto #282

Open
finnhambly opened this issue Feb 14, 2022 · 1 comment
Open

ArchGDAL.Feature unable to be shown in Pluto #282

finnhambly opened this issue Feb 14, 2022 · 1 comment
Labels

Comments

@finnhambly
Copy link

When layer = ArchGDAL.getlayer(dataset, 0) is called in a single-line Pluto cell (or at the end of a multi-line Pluto cell), the following error is thrown:

Failed to show value:
MethodError: no method matching length(::ArchGDAL.Feature)
Closest candidates are:
length(!Matched::Union{Base.KeySet, Base.ValueIterator}) at /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/base/abstractdict.jl:58
length(!Matched::Union{Tables.AbstractColumns, Tables.AbstractRow}) at ~/.julia/packages/Tables/M26tI/src/Tables.jl:175
length(!Matched::Union{DataStructures.OrderedRobinDict, DataStructures.RobinDict}) at ~/.julia/packages/DataStructures/vSp4s/src/ordered_robin_dict.jl:86
...
1. table_data(::ArchGDAL.IFeatureLayer, ::IOContext{IOBuffer})@PlutoRunner.jl:1359
2. show_richest(::IOContext{IOBuffer}, ::Any)@PlutoRunner.jl:1004
3. var"#sprint_withreturned#54"(::IOContext{Base.DevNull}, ::Int64, ::typeof(Main.PlutoRunner.sprint_withreturned), ::Function, ::ArchGDAL.IFeatureLayer)@PlutoRunner.jl:954
4. format_output_default(::Any, ::Any)@PlutoRunner.jl:862
5. var"#format_output#42"(::IOContext{Base.DevNull}, ::typeof(Main.PlutoRunner.format_output), ::Any)@PlutoRunner.jl:879
6. formatted_result_of(::Base.UUID, ::Bool, ::Vector{String}, ::Nothing, ::Module)@PlutoRunner.jl:785
7. top-level scope@none:1

Looks like a new method for length should be created, or perhaps the returned value type ought to be changed.

Related: JuliaGeo/Shapefile.jl#50

As pointed out by @felixcremer on the Slack channel, this error can be worked around with layer |> DisplayAs.Text. Otherwise, the output can be suppressed entirely with ;.

@yeesian
Copy link
Owner

yeesian commented Apr 1, 2022

Thank you for filing this; as a feature has both fields and geometries, it is unclear what the "length" of a feature should correspond to, and what it means to be iterating over it, so I'm not ready to support it yet -- happy to have a discussion around it if that's helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants