Skip to content

Can't read crs from simple flatgeobuf written with GDF #91

@alex-s-gardner

Description

@alex-s-gardner
import GeoFormatTypes as GFT
import GeoInterface as GI
using DataFrames
using GeoDataFrames

outfile = joinpath(tempdir(), "test.fgb");
pt = GI.Point(1,1, crs=GFT.EPSG(4326))

df = DataFrame(geometry=pt, test=1.)
GeoDataFrames.write(outfile, df)
test = GeoDataFrames.read(outfile)

produces this error

ERROR: Failed to convert this SRS into WKT format (Failure.)
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] macro expansion
    @ ~/.julia/packages/ArchGDAL/aXTAq/src/utils.jl:210 [inlined]
  [3] toWKT(spref::ArchGDAL.ISpatialRef)
    @ ArchGDAL ~/.julia/packages/ArchGDAL/aXTAq/src/spatialref.jl:591
  [4] read(ds::ArchGDAL.Dataset, layer::Int64)
    @ GeoDataFrames ~/.julia/packages/GeoDataFrames/eP9Sg/src/io.jl:96
  [5] (::GeoDataFrames.var"#10#11")(ds::ArchGDAL.Dataset)
    @ GeoDataFrames ~/.julia/packages/GeoDataFrames/eP9Sg/src/io.jl:62
  [6] read(f::GeoDataFrames.var"#10#11", args::String; kwargs::@Kwargs{})
    @ ArchGDAL ~/.julia/packages/ArchGDAL/aXTAq/src/context.jl:268
  [7] read
    @ ~/.julia/packages/ArchGDAL/aXTAq/src/context.jl:265 [inlined]
  [8] read(fn::String; kwargs::@Kwargs{})
    @ GeoDataFrames ~/.julia/packages/GeoDataFrames/eP9Sg/src/io.jl:58
  [9] read(fn::String)
    @ GeoDataFrames ~/.julia/packages/GeoDataFrames/eP9Sg/src/io.jl:52
 [10] top-level scope
    @ ~/Documents/GitHub/Altim.jl/src/import GeoFormatTypes as GFT.jl:70

other file types DO NOT have this issue:

import GeoFormatTypes as GFT
import GeoInterface as GI
using DataFrames
using GeoDataFrames

pt = GI.Point(1,1, crs=GFT.EPSG(4326))
df = DataFrame(geometry=pt, test=1.)

fn = ["test.geojson", "test.fgb", "test.shp", "test.gpkg"]
for f in fn
    outfile = joinpath(tempdir(), f);
    GeoDataFrames.write(outfile, df)
    try
        test = GeoDataFrames.read(outfile)
    catch e
        println("causes read error: $f")
    end
end

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