diff --git a/src/io.jl b/src/io.jl index 2f51b80..e0977bd 100644 --- a/src/io.jl +++ b/src/io.jl @@ -51,5 +51,11 @@ function read(fn::Union{AbstractString,Parquet2.FilePathsBase.AbstractPath,Parqu for column in keys(meta.columns) df[!, column] = GFT.WellKnownBinary.(Ref(GFT.Geom()), df[!, column]) end + # set GeoInterface metadata + metadata!(df, "GEOINTERFACE:geometrycolumns", Tuple(Symbol.(keys(meta.columns)))) + crs = meta.columns[meta.primary_column].crs + if !isnothing(crs) + metadata!(df, "GEOINTERFACE:crs", crs) + end df end diff --git a/test/runtests.jl b/test/runtests.jl index a837776..42201ac 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -37,6 +37,9 @@ end df = GeoParquet.read(fn) @test nrow(df) === 5 @test df.geometry[1] isa GFT.WellKnownBinary + # GeoInterface metadata + @test metadata(df, "GEOINTERFACE:geometrycolumns") == (:geometry,) + @test metadata(df, "GEOINTERFACE:crs") isa GFT.ProjJSON @test_throws Exception GeoParquet.read(fn, columns=(:geom,)) end