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

Make the default geometry columns in GeoParquet.write be GI.geometrycolumns #23

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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "GeoParquet"
uuid = "e99870d8-ce00-4fdd-aeee-e09192881159"
authors = ["Maarten Pronk <[email protected]> and contributors."]
version = "0.2.2"
version = "0.3.0"

[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Expand Down
2 changes: 1 addition & 1 deletion src/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Write a dataframe with a geometry column to a Parquet file. Returns `ofn` on suc
The geometry column should be a `Vector{GeoFormat.WellKnownBinary}` or its elements should support GeoInterface.
You can construct one with WellKnownGeometry for geometries that support GeoInterface.
"""
function write(ofn::Union{AbstractString,Parquet2.FilePathsBase.AbstractPath}, df, geocolumns=(:geom,), crs::Union{GFT.ProjJSON,Nothing}=nothing, bbox::Union{Nothing,Vector{Float64}}=nothing; kwargs...)
function write(ofn::Union{AbstractString,Parquet2.FilePathsBase.AbstractPath}, df, geocolumns=GI.geometrycolumns(df), crs::Union{GFT.ProjJSON,Nothing}=nothing, bbox::Union{Nothing,Vector{Float64}}=nothing; kwargs...)

# Tables.istable(df) || throw(ArgumentError("`df` must be a table"))

Expand Down
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ end
wkb = ArchGDAL.toWKB.(geom)
df = DataFrame(test="test", value=rand(2), geometry=wkb)
fn = "data/write.parquet"
GeoParquet.write(fn, df, (:geometry,))
GeoParquet.write(fn, df)
df = GeoParquet.read(fn)
df.test[1] == "test"

# Transparently convert columns to WKB
fn = "data/writec.parquet"
df = DataFrame(test="test", value=rand(2), geom=geom)
GeoParquet.write(fn, df)
GeoParquet.write(fn, df, (:geom,))
ndf = GeoParquet.read(fn)
df.geom != ndf.geom # original is not mutated

Expand Down
Loading