Skip to content

Commit e67e528

Browse files
jaakkor2visr
authored andcommitted
docstrings for setPrecsion, getPrecision; setPrecision returns a geometry
1 parent acdb66c commit e67e528

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/geos_functions.jl

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1102,6 +1102,11 @@ nearestPoints(g1::GEOSGeom, g2::GEOSGeom, context::GEOSContext = _context) =
11021102
# Precision functions
11031103
# -----
11041104

1105+
"""
1106+
getPrecision(geom)
1107+
1108+
Return the size of the geometry's precision grid, 0 for FLOATING precision.
1109+
"""
11051110
function getPrecision(geom::GEOSGeom, context::GEOSContext = _context)
11061111
result = GEOSGeom_getPrecision_r(context.ptr, geom)
11071112
if result == C_NULL
@@ -1110,8 +1115,23 @@ function getPrecision(geom::GEOSGeom, context::GEOSContext = _context)
11101115
result
11111116
end
11121117

1118+
"""
1119+
setPrecision(geom, gridSize; flags = 0)
1120+
1121+
Set the geometry's precision, optionally rounding all its coordinates to the
1122+
precision grid (if it changes).
1123+
1124+
Note that operations will always be performed in the precision
1125+
of the geometry with higher precision (smaller `gridSize`).
1126+
That same precision will be attached to the operation outputs.
1127+
1128+
* `gridSize` size of the precision grid, or 0 for FLOATING precision.
1129+
* `flags` The bitwise OR of one of more of the "precision options"
1130+
* `LibGEOS.GEOS_PREC_KEEP_COLLAPSED` retain collapsed elements
1131+
* `LibGEOS.GEOS_PREC_NO_TOPO` do not attempt at preserving the topology
1132+
"""
11131133
function setPrecision(geom::GEOSGeom, gridSize::Real, flags::Int, context::GEOSContext = _context)
1114-
result = GEOSGeom_setPrecision_r(context.ptr, geom, gridSize, flags)
1134+
result = geomFromGEOS(GEOSGeom_setPrecision_r(context.ptr, geom, gridSize, flags))
11151135
if result == C_NULL
11161136
error("LibGEOS: Error in GEOSGeom_setPrecision_r")
11171137
end

0 commit comments

Comments
 (0)