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

Table throws an error, but inside shapes it works. #62

Closed
roland-KA opened this issue Dec 10, 2021 · 1 comment
Closed

Table throws an error, but inside shapes it works. #62

roland-KA opened this issue Dec 10, 2021 · 1 comment

Comments

@roland-KA
Copy link

When calling ctables = Shapefile.Table("./ne_110m_admin_0_countries.shp") (as shown in 'quick start'), I get the following error:

ctables Failed to show value: MethodError: no method matching length(::Shapefile.Row{Shapefile.Polygon}) Closest candidates are: length(!Matched::Union{Base.KeySet, Base.ValueIterator}) at abstractdict.jl:58 length(!Matched::Union{DataStructures.OrderedRobinDict, DataStructures.RobinDict}) at /Users/roland/.julia/packages/DataStructures/nBjdy/src/ordered_robin_dict.jl:86 length(!Matched::Union{DataStructures.SortedDict, DataStructures.SortedMultiDict, DataStructures.SortedSet}) at /Users/roland/.julia/packages/DataStructures/nBjdy/src/container_loops.jl:322

`...

  1. table_data(::Shapefile.Table{Union{Missing, Shapefile.Polygon}}, ::IOContext{IOBuffer})@PlutoRunner.jl:1367
  2. show_richest(::IOContext{IOBuffer}, ::Any)@PlutoRunner.jl:1012
    var"#sprint_withreturned#54"(::IOContext{Base.DevNull}, ::Int64, ::typeof(Main.PlutoRunner.sprint_withreturned), ::Function, ::Shapefile.Table{Union{Missing, Shapefile.Polygon}})@PlutoRunner.jl:962
  3. format_output_default(::Any, ::Any)@PlutoRunner.jl:857
    var"#format_output#42"(::IOContext{Base.DevNull}, ::typeof(Main.PlutoRunner.format_output), ::Any)@PlutoRunner.jl:874
  4. formatted_result_of(::Base.UUID, ::Bool, ::Vector{String}, ::Nothing, ::Module)@PlutoRunner.jl:780
  5. top-level scope@none:1`

But when I embed that expression in a call to shapes like:

geoms = Shapefile.shapes(Shapefile.Table("./ne_110m_admin_0_countries.shp"))

Then erverything works as expected. So why does the isolated Tables statement cause an error?

@visr
Copy link
Member

visr commented Dec 10, 2021

The reason the first line fails is because it crashes when trying to show the output in Pluto. I'll close this as a duplicate of #50.

@visr visr closed this as completed Dec 10, 2021
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

No branches or pull requests

2 participants