Polygon

class Polygon(polyLats: DoubleArray, polyLons: DoubleArray, holes: Polygon) : LatLonGeometry

Represents a closed polygon on the earth's surface. You can either construct the Polygon directly yourself with double[] coordinates, or use Polygon.fromGeoJSON if you have a polygon already encoded as a GeoJSON string.

NOTES:

  1. Coordinates must be in clockwise order, except for holes. Holes must be in counter-clockwise order.

  2. The polygon must be closed: the first and last coordinates need to have the same values.

  3. The polygon must not be self-crossing, otherwise may result in unexpected behavior.

  4. All latitude/longitude values must be in decimal degrees.

  5. Polygons cannot cross the 180th meridian. Instead, use two polygons: one on each side.

  6. For more advanced GeoSpatial indexing and query operations see the spatial-extras module

Constructors

Link copied to clipboard
constructor(polyLats: DoubleArray, polyLons: DoubleArray, vararg holes: Polygon)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

maximum latitude of this polygon's bounding box area

Link copied to clipboard

maximum longitude of this polygon's bounding box area

Link copied to clipboard

minimum latitude of this polygon's bounding box area

Link copied to clipboard

minimum longitude of this polygon's bounding box area

Functions

Link copied to clipboard
open operator override fun equals(obj: Any?): Boolean
Link copied to clipboard
Link copied to clipboard

Returns a copy of the internal holes array

Link copied to clipboard
fun getPolyLat(vertex: Int): Double

Returns latitude value at given index

Link copied to clipboard

Returns a copy of the internal latitude array

Link copied to clipboard
fun getPolyLon(vertex: Int): Double

Returns longitude value at given index

Link copied to clipboard

Returns a copy of the internal longitude array

Link copied to clipboard

Returns the winding order (CW, COLINEAR, CCW) for the polygon shell

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun numHoles(): Int

returns the number of holes for the polygon

Link copied to clipboard
fun numPoints(): Int

returns the number of vertex points

Link copied to clipboard

prints polygons as geojson

Link copied to clipboard
open override fun toString(): String