Skip to content

"ERROR: EOFError: read end of file" on filr that opens without issue using other software #100

@alex-s-gardner

Description

@alex-s-gardner

I get a "EOFError: read end of file" error when reading in a shapefile that opens without issue in QGIS. I poked around a bit but could't identify the issue.

using Shapefile

# the shapefiles can be downloaded from NSIDC: https://nsidc.org/data/nsidc-0770/versions/7 
# but you will require an Earth Data Login

# for convenience I've temporarily put the files here
fn = "RGI2000-v7.0-C-02_western_canada_usa"
url2shp =  "https://its-live-data.s3.amazonaws.com/test/$fn.zip"

# download and unzip
Downloads.download(url2shp, "$fn.zip")
run(`unzip $fn`)

# read file
g = Shapefile.Handle("$fn.shp")

ERROR: EOFError: read end of file
Stacktrace:
  [1] unsafe_read(s::IOStream, p::Ptr{UInt8}, nb::UInt64)
    @ Base ./iostream.jl:428
  [2] unsafe_read
    @ ./io.jl:761 [inlined]
  [3] read!
    @ ./io.jl:779 [inlined]
  [4] _readparts
    @ ~/.julia/packages/Shapefile/yESZK/src/utils.jl:7 [inlined]
  [5] read(io::IOStream, #unused#::Type{Shapefile.PolygonZ})
    @ Shapefile ~/.julia/packages/Shapefile/yESZK/src/polygons.jl:221
  [6] _read_handle_inner(io::IOStream, ::Type{Shapefile.PolygonZ}, header::Shapefile.Header, shapes::Function, index::Nothing; path::String)
    @ Shapefile ~/.julia/packages/Shapefile/yESZK/src/handle.jl:59
  [7] read(io::IOStream, ::Type{Shapefile.Handle}, index::Nothing; path::String)
    @ Shapefile ~/.julia/packages/Shapefile/yESZK/src/handle.jl:45
  [8] read
    @ ~/.julia/packages/Shapefile/yESZK/src/handle.jl:42 [inlined]
  [9] #13
    @ ~/.julia/packages/Shapefile/yESZK/src/handle.jl:20 [inlined]
 [10] open(f::Shapefile.var"#13#14"{String, Nothing}, args::String; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Base ./io.jl:395
 [11] open
    @ ./io.jl:392 [inlined]
 [12] Handle
    @ ~/.julia/packages/Shapefile/yESZK/src/handle.jl:19 [inlined]
 [13] Shapefile.Handle(path::String)
    @ Shapefile ~/.julia/packages/Shapefile/yESZK/src/handle.jl:19
 [14] top-level scope
    @ REPL[25]:1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions