Skip to content

Commit 1805746

Browse files
committed
Fixed bug in coordinates.
1 parent 7ee9ace commit 1805746

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/defaults.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ function coordinates(::AbstractPointTrait, geom)
9191
collect(getcoord(geom))
9292
end
9393
function coordinates(::AbstractGeometryTrait, geom)
94-
collect(coordinates(getgeom(geom)))
94+
collect(coordinates.(getgeom(geom)))
9595
end
9696

9797
# Subtraits

test/test_primitives.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ struct MyPoint end
99
GeoInterface.geomtype(::MyPoint) = GeoInterface.PointTrait()
1010
GeoInterface.geomtype(::MyCurve) = GeoInterface.LineStringTrait()
1111
GeoInterface.ncoord(::GeoInterface.PointTrait, geom::MyPoint) = 2
12-
GeoInterface.getcoord(::GeoInterface.PointTrait, geom::MyPoint, i) = [[1, 2], [2, 3]][i]
12+
GeoInterface.getcoord(::GeoInterface.PointTrait, geom::MyPoint, i) = [1, 2][i]
1313
GeoInterface.ngeom(::GeoInterface.LineStringTrait, geom::MyCurve) = 2
1414
GeoInterface.getgeom(::GeoInterface.LineStringTrait, geom::MyCurve, i) = MyPoint()
1515
GeoInterface.convert(::Type{MyCurve}, ::GeoInterface.LineStringTrait, geom) = geom
@@ -21,6 +21,7 @@ struct MyPoint end
2121

2222
# Check functions
2323
@test GeoInterface.npoint(geom) == 2 # defaults to ngeom
24+
@test GeoInterface.coordinates(geom) == [[1, 2], [1, 2]]
2425
@test_throws MethodError GeoInterface.area(geom)
2526

2627
end

0 commit comments

Comments
 (0)