Skip to content

Commit

Permalink
switch from Base.convert to GeoInterface.convert (#359)
Browse files Browse the repository at this point in the history
  • Loading branch information
visr authored Jan 7, 2023
1 parent 17d6a1c commit dd34eed
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- breaking: Updated compat for GDAL.jl 1.5 and fixed tests for GDAL 3.6. These include changes to `gdalnearblack`, `fillunsetwithdefault!` and `gdalgetgeotransform`.
- breaking: Use `GeoInterface.convert` instead of `convert` to convert geometries from other
packages to ArchGDAL via the GeoInterface. Example: `GeoInterface.convert(AG.IGeometry, geom)`

## [0.9.4] - 2022-12-30

Expand Down
15 changes: 1 addition & 14 deletions src/geointerface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -278,20 +278,7 @@ let pointtypes = (wkbPoint, wkbPoint25D, wkbPointM, wkbPointZM),
return toWKT(geom)
end

function Base.convert(::Type{T}, geom::X) where {T<:IGeometry,X}
return Base.convert(T, GeoInterface.geomtrait(geom), geom)
end
function Base.convert(
::Type{T},
::GeometryTraits,
geom::T,
) where {T<:IGeometry}
return geom
end # fast fallthrough without conversion
function Base.convert(::Type{T}, ::Nothing, geom::T) where {T<:IGeometry}
return geom
end # fast fallthrough without conversion
function Base.convert(
function GeoInterface.convert(
::Type{T},
type::GeometryTraits,
geom,
Expand Down
2 changes: 1 addition & 1 deletion test/test_geometry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ import GeoFormatTypes as GFT
GI.getgeom(::GI.LineStringTrait, geom::MyLine, i) = MyPoint()

geom = MyLine()
ag_geom = convert(AG.IGeometry, geom)
ag_geom = GI.convert(AG.IGeometry, geom)
GI.coordinates(ag_geom) == [[1, 2], [1, 2]]
end
end

2 comments on commit dd34eed

@yeesian
Copy link
Owner

@yeesian yeesian commented on dd34eed Jan 7, 2023

Choose a reason for hiding this comment

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

@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/75302

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.10.0 -m "<description of version>" dd34eedd7605d350811f614adcebe20cd15c3f11
git push origin v0.10.0

Please sign in to comment.