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
Changes from 2 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
9 changes: 8 additions & 1 deletion src/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,15 @@ function read(fn::Union{AbstractString,Parquet2.FilePathsBase.AbstractPath,Parqu
is_valid(ds) || error("Not a valid GeoParquet file")
meta = geometadata(ds)
df = DataFrame(ds; copycols=false)
for column in keys(meta.columns)
geocolumns = Symbol.(keys(meta.columns))
for column in geocolumns
df[!, column] = GFT.WellKnownBinary.(Ref(GFT.Geom()), df[!, column])
end
# set GeoInterface metadata
metadata!(df, "GEOINTERFACE:geometrycolumns", geocolumns)
eliascarv marked this conversation as resolved.
Show resolved Hide resolved
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
Loading