Shapefile.jl icon indicating copy to clipboard operation
Shapefile.jl copied to clipboard

returns SubString when should return String according to schema

Open asinghvi17 opened this issue 8 months ago • 0 comments

Maybe this is a DBFTables problem but try

collect(Tables.namedtupleiterator(tbl))

on any Shapefile that has a string column

it returns an error

ERROR: TypeError: in new, expected Union{Missing, String}, got a value of type SubString{String}
Stacktrace:
 [1] macro expansion
   @ ~/.julia/packages/Tables/8p03y/src/namedtuples.jl:50 [inlined]
 [2] _iterate(rows::Tables.NamedTupleIterator{Tables.Schema{…}, Shapefile.Table{…}}, st::Tuple{})
   @ Tables ~/.julia/packages/Tables/8p03y/src/namedtuples.jl:41
 [3] iterate
   @ ~/.julia/packages/Tables/8p03y/src/namedtuples.jl:62 [inlined]
 [4] iterate
   @ ~/.julia/packages/Tables/8p03y/src/namedtuples.jl:61 [inlined]
 [5] copyto!(dest::Vector{@NamedTuple{…}}, src::Tables.NamedTupleIterator{Tables.Schema{…}, Shapefile.Table{…}})
   @ Base ./abstractarray.jl:934
 [6] _collect
   @ ./array.jl:722 [inlined]
 [7] collect(itr::Tables.NamedTupleIterator{Tables.Schema{…}, Shapefile.Table{…}})
   @ Base ./array.jl:716
 [8] top-level scope
   @ REPL[6]:1
Some type information was truncated. Use `show(err)` to see complete types.

If this is a DBFTables thing I can move it there, but something has to be done here

asinghvi17 avatar Apr 24 '25 02:04 asinghvi17