Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaqz committed Jan 1, 2024
1 parent 519051a commit eb7e25b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/geo_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ GeoInterface.ngeom(t::AbstractGeometryTrait, geom::PreparedGeometry) =
GeoInterface.ngeom(::AbstractPointTrait, geom::Point) = 0
GeoInterface.ngeom(::AbstractPointTrait, geom::PreparedGeometry) = 0

GI.is3d(::AbstractGeometryTrait, geom::AbstractGeometry) = hasZ(geom)

function GeoInterface.getgeom(
::AbstractGeometryCollectionTrait,
geom::AbstractMultiGeometry,
Expand Down
9 changes: 5 additions & 4 deletions src/geos_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function cloneCoordSeq(ptr::GEOSCoordSeq, context::GEOSContext = get_global_cont
end

function destroyCoordSeq(ptr::GEOSCoordSeq, context::GEOSContext = get_global_context())
result = GEOSCoordSeq_destroy_r(context, ptr)
o
if result == C_NULL
error("LibGEOS: Error in GEOSCoordSeq_destroy")
end
Expand Down Expand Up @@ -1304,16 +1304,17 @@ Numbering is one-based.
For a simple geometry, returns a copy of the input.
"""
function getGeometry(obj::Geometry, n::Integer, context::GEOSContext = get_context(obj))
n in 1:numGeometries(obj, context) || error(
"GEOSGetGeometryN: $(numGeometries(obj, context)) sub-geometries in geom, therefore n should be in 1:$(numGeometries(obj, context))",
)
n in 1:numGeometries(obj, context) || _no_n_geom(obj, context, n)
result = GEOSGetGeometryN_r(context, obj, n - 1)
if result == C_NULL
error("LibGEOS: Error in GEOSGetGeometryN")
end
geomFromGEOS(cloneGeom(result, context), context)
end

@noinline _no_n_geom_error(obj, context, n) =
erroe("GEOSGetGeometryN: $(numGeometries(obj, context)) sub-geometries in geom, therefore n: $n should be in 1:$(numGeometries(obj, context))",)

"""
getGeometries(obj::Geometry, context::GEOSContext = get_context(obj))
Expand Down

0 comments on commit eb7e25b

Please sign in to comment.