Skip to content

Commit dd34eed

Browse files
authored
switch from Base.convert to GeoInterface.convert (#359)
1 parent 17d6a1c commit dd34eed

File tree

3 files changed

+4
-15
lines changed

3 files changed

+4
-15
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717
### Changed
1818

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

2123
## [0.9.4] - 2022-12-30
2224

src/geointerface.jl

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -278,20 +278,7 @@ let pointtypes = (wkbPoint, wkbPoint25D, wkbPointM, wkbPointZM),
278278
return toWKT(geom)
279279
end
280280

281-
function Base.convert(::Type{T}, geom::X) where {T<:IGeometry,X}
282-
return Base.convert(T, GeoInterface.geomtrait(geom), geom)
283-
end
284-
function Base.convert(
285-
::Type{T},
286-
::GeometryTraits,
287-
geom::T,
288-
) where {T<:IGeometry}
289-
return geom
290-
end # fast fallthrough without conversion
291-
function Base.convert(::Type{T}, ::Nothing, geom::T) where {T<:IGeometry}
292-
return geom
293-
end # fast fallthrough without conversion
294-
function Base.convert(
281+
function GeoInterface.convert(
295282
::Type{T},
296283
type::GeometryTraits,
297284
geom,

test/test_geometry.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ import GeoFormatTypes as GFT
10051005
GI.getgeom(::GI.LineStringTrait, geom::MyLine, i) = MyPoint()
10061006

10071007
geom = MyLine()
1008-
ag_geom = convert(AG.IGeometry, geom)
1008+
ag_geom = GI.convert(AG.IGeometry, geom)
10091009
GI.coordinates(ag_geom) == [[1, 2], [1, 2]]
10101010
end
10111011
end

0 commit comments

Comments
 (0)