Skip to content

Commit 2eb19a4

Browse files
committed
f
1 parent c479021 commit 2eb19a4

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/geo_interface.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function GeoInterface.getgeom(::AbstractGeometryTrait, geom::Union{LineString,Li
5454
return _get_tuple_point(geom, seq, refs, i)
5555
end
5656
function GeoInterface.getgeom(::AbstractGeometryTrait, geom::Union{LineString,LinearRing})
57-
context = get_global_context()
57+
context = get_context(geom)
5858
seq = getCoordSeq(geom, context)
5959
n = getSize(seq, context) # Faster thatn `GI.ngeom(geom)` when we already have `seq`
6060
# Preallocate refse
@@ -65,7 +65,7 @@ function GeoInterface.getgeom(::AbstractGeometryTrait, geom::Union{LineString,Li
6565
return (_get_tuple_point(geom, seq, refs, i, context, hasz) for i in UInt32(1):UInt32(n))
6666
end
6767

68-
function _get_tuple_point(geom, seq, (x, y, z), i, context = get_global_context(), hasz=hasZ(geom, context))
68+
function _get_tuple_point(geom, seq, (x, y, z), i, context=get_context(geom), hasz=hasZ(geom, context))
6969
if hasz
7070
GEOSCoordSeq_getXYZ_r(context, seq, i - UInt32(1), x, y, z)
7171
return x[], y[], Z[]
@@ -74,7 +74,6 @@ function _get_tuple_point(geom, seq, (x, y, z), i, context = get_global_context(
7474
return x[], y[]
7575
end
7676
end
77-
7877
GeoInterface.getgeom(t::AbstractPointTrait, geom::PreparedGeometry) = nothing
7978
function GeoInterface.getgeom(::PolygonTrait, geom::Polygon, i::Int)
8079
if i == 1

src/geos_functions.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ function cloneCoordSeq(ptr::GEOSCoordSeq, context::GEOSContext = get_global_cont
9797
end
9898

9999
function destroyCoordSeq(ptr::GEOSCoordSeq, context::GEOSContext = get_global_context())
100-
o
100+
result = GEOSCoordSeq_destroy_r(context, ptr)
101101
if result == C_NULL
102102
error("LibGEOS: Error in GEOSCoordSeq_destroy")
103103
end
@@ -1306,17 +1306,16 @@ Numbering is one-based.
13061306
For a simple geometry, returns a copy of the input.
13071307
"""
13081308
function getGeometry(obj::Geometry, n::Integer, context::GEOSContext = get_context(obj))
1309-
n in 1:numGeometries(obj, context) || _no_n_geom(obj, context, n)
1309+
n in 1:numGeometries(obj, context) || error(
1310+
"GEOSGetGeometryN: $(numGeometries(obj, context)) sub-geometries in geom, therefore n should be in 1:$(numGeometries(obj, context))",
1311+
)
13101312
result = GEOSGetGeometryN_r(context, obj, n - 1)
13111313
if result == C_NULL
13121314
error("LibGEOS: Error in GEOSGetGeometryN")
13131315
end
13141316
geomFromGEOS(cloneGeom(result, context), context)
13151317
end
13161318

1317-
@noinline _no_n_geom_error(obj, context, n) =
1318-
erroe("GEOSGetGeometryN: $(numGeometries(obj, context)) sub-geometries in geom, therefore n: $n should be in 1:$(numGeometries(obj, context))",)
1319-
13201319
"""
13211320
getGeometries(obj::Geometry, context::GEOSContext = get_context(obj))
13221321

0 commit comments

Comments
 (0)