tryBuffer

fun tryBuffer(geometries: Iterable<Geometry>, distances: Iterable<Double>, unionResult: Boolean): List<Polygon>

Creates a buffer or buffers relative to the given collection of geometries. This is a planar buffer operation. Use GeometryEngine.bufferGeodeticOrNull to produce geodetic buffers. This planar measurement uses 2D Cartesian mathematics to compute the buffer areas. It is based upon the SpatialReference of the input geometries. If the input geometries do not use an 'area preserving' spatial reference, the results can be inaccurate. You have two options available to calculate a more accurate results:

If unionResult is true, the output collection contains a single result. If geometries is empty, an empty array is returned.

Supports true curves as input, producing a densified curve as output where applicable.

This method allows you to create different-sized buffers for each input in a geometry collection using corresponding values in a distance collection. Typically, there's a one-to-one correspondence of input geometries to the input buffer distances. However, you may have fewer input buffer distances than input geometries. In that case, the last distance value in the buffer distances collection is applied to the remaining geometries. If needed, you could also specify a single buffer value in the input buffer distances collection to apply to all items in the input geometries collection.

Return

A collection of polygons representing buffers at the defined distance(s) relative to the input geometries. Returns an empty list if geometries is empty or the arguments are invalid.

Since

200.1.0

Parameters

geometries

A collection of geometries.

distances

The distance to buffer each geometry, expressed as a MutableList of double. If the size of the distances collection is less than the number of geometries, the last distance value is used for the rest of geometries.

unionResult

Returns a single geometry that buffers all the geometries (true), or one buffer for each in the given collection (false).