geometry.json.polygon

Extends IGeometryJson.

An object that defines the JSON representation of the "Polygon" geometry.

Constructor | Fields

Constructor

geometry.json.polygon()

Example:

var geometryJson = {
    type: "Polygon",
    coordinates: [
        [[0, 0], [7, 11]],
        [[1, 2], [3, 5]]
    ]
};

Fields

Name

Type

Description

coordinates

Number[][][]

Coordinates of the polygon.

fillRule

String

ID of the polygon fill rule. Accepts one of two values:

  • evenOdd - Algorithm that checks whether a point is located in the fill area by drawing a ray from this point to infinity in any direction, and counting the number of contour segments in this shape that are crossed by this ray. If the number is odd, the point is inside it; if even, the point is outside it.
  • nonZero - Algorithm that checks whether a point is located in the fill area by drawing a ray from this point to infinity in any direction, and checking the points at which a segment of the shape crosses this ray. Starting from zero, one is added each time a segment crosses the ray from left to right, and one is subtracted each time a segment crosses the ray from right to left. If the result equals zero, the point is inside the contour. Otherwise, it is outside it.

type

String

ID of the geometry type.

Inherited from IGeometryJson.

Fields details

coordinates

{Number[][][]} coordinates

Coordinates of the polygon.

fillRule

{String} fillRule

ID of the polygon fill rule. Accepts one of two values:

  • evenOdd - Algorithm that checks whether a point is located in the fill area by drawing a ray from this point to infinity in any direction, and counting the number of contour segments in this shape that are crossed by this ray. If the number is odd, the point is inside it; if even, the point is outside it.
  • nonZero - Algorithm that checks whether a point is located in the fill area by drawing a ray from this point to infinity in any direction, and checking the points at which a segment of the shape crosses this ray. Starting from zero, one is added each time a segment crosses the ray from left to right, and one is subtracted each time a segment crosses the ray from right to left. If the result equals zero, the point is inside the contour. Otherwise, it is outside it.