Skip to content

Add more informative error when trying to write vector of geometry #80

@alex-s-gardner

Description

@alex-s-gardner

load data

using GeoDataFrames
using Shapefile

path2shp = splitpath(pathof(Shapefile))
path2shp = joinpath(vcat(path2shp[1:end-2], ["test", "shapelib_testcases", "test.shp"]))

gdf = GeoDataFrames.read(path2shp)

write geopackage with attributes [works as expected]

GeoDataFrames.write("test.gpkg", gdf)

write geopackage with geometry only [I would have thought this would work but it doesn't]

GeoDataFrames.write("test.gpkg", gdf[:,:geometry])
ERROR: type IGeometry has no field geometry
Stacktrace:
 [1] getproperty
   @ ./Base.jl:37 [inlined]
 [2] getcolumn
   @ ~/.julia/packages/Tables/8p03y/src/Tables.jl:102 [inlined]
 [3] getcolumn
   @ ~/.julia/packages/Tables/8p03y/src/tofromdatavalues.jl:73 [inlined]
 [4] getproperty
   @ ~/.julia/packages/Tables/8p03y/src/Tables.jl:186 [inlined]
 [5] write(fn::String, table::Vector{…}; layer_name::String, crs::Nothing, driver::Nothing, options::Dict{…}, geom_columns::Tuple{…}, chunksize::Int64, kwargs::@Kwargs{})
   @ GeoDataFrames ~/.julia/packages/GeoDataFrames/eP9Sg/src/io.jl:136
 [6] write(fn::String, table::Vector{ArchGDAL.IGeometry{ArchGDAL.wkbPolygon}})
   @ GeoDataFrames ~/.julia/packages/GeoDataFrames/eP9Sg/src/io.jl:112
 [7] top-level scope
   @ ~/Documents/GitHub/Altim.jl/src/junk9.jl:12
Some type information was truncated. Use `show(err)` to see complete types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions