Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for GeoInterface CRS metadata #25

Merged
merged 4 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
asinghvi17 marked this conversation as resolved.
Show resolved Hide resolved
if !isnothing(crs)
metadata!(df, "GEOINTERFACE:crs", crs)
end
df
end
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading