Skip to content

Commit

Permalink
Make the default geometry columns in GeoParquet.write be `GI.geomet…
Browse files Browse the repository at this point in the history
…rycolumns` (#23)

* Make the default geometry columns in `GeoParquet.write` be `GI.geometrycolumns`

* Fix tests.

---------

Co-authored-by: Maarten Pronk <[email protected]>
  • Loading branch information
asinghvi17 and evetion authored Dec 20, 2024
1 parent e16dd7d commit 0b9dcdf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
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

4 comments on commit 0b9dcdf

@evetion
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register:

Release notes:

Breaking changes

  • Changed default geometry column name(s) from (geom,) to (geometry,).

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/121749

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.0 -m "<description of version>" 0b9dcdfa5a26df0537126bc3cbb770ff17c74a74
git push origin v0.3.0

@evetion
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register:

Release notes:

Breaking changes

  • Changed default geometry column name(s) from (geom,) to (geometry,).

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request updated: JuliaRegistries/General/121749

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.0 -m "<description of version>" 0b9dcdfa5a26df0537126bc3cbb770ff17c74a74
git push origin v0.3.0

Please sign in to comment.