Skip to main content

Type Definitions

Geometry

edit
Point<P> | LineString<P> | LinearRing<P> | Polygon<P> | MultiPoint<P> | MultiLineString<P> | MultiPolygon<P> | GeometryCollection<P> | CircularString<P> | CompoundCurve<P> | CurvePolygon<P> | MultiCurve<P> | MultiSurface<P>
  • P - The type of optional data assigned to a geometry instance.

Union type of all possible geometry types.

Each geometry type is an instance of GeometryRef.

Prepared

edit
G & { [ __PREPARED__ ]: true }
  • G - The type of prepared geometry, for example, Geometry or more specific Polygon

Branded type representing one of geometries that was prepared.

Point

edit

Point is an instance of GeometryRef that represents the point geometry.

Point extends GeometryRef.

Type Parameters

  • P

Properties

type readonly

'Point'

Methods

toJSON

clone

() -> Point<P>

See also

  • point creates a point geometry from a single coordinate

Examples

const a = fromGeoJSON({ type: 'Point', coordinates: [ 0, 0 ] });
const b = point([ 0, 0 ]); // shortcut to above
const c = fromWKT('POINT (0 0)');

LineString

edit

LineString is an instance of GeometryRef that represents the line string geometry.

LineString extends GeometryRef.

Type Parameters

  • P

Properties

type readonly

'LineString'

Methods

toJSON

clone

() -> LineString<P>

See also

  • lineString creates a line string geometry from an array of positions

Examples

const a = fromGeoJSON({
    type: 'LineString',
    coordinates: [ [ 0, 0 ], [ 1, 1 ], [ 2, 2 ] ],
});
const b = lineString([ [ 0, 0 ], [ 1, 1 ], [ 2, 2 ] ]); // shortcut to above
const c = fromWKT('LINESTRING (0 0, 1 1, 2 2)');

LinearRing

edit

LinearRing extends GeometryRef.

Type Parameters

  • P

Properties

type readonly

'LinearRing'

Methods

toJSON

() -> never

clone

() -> LinearRing<P>

Polygon

edit

Polygon is an instance of GeometryRef that represents the polygon geometry.

Polygon extends GeometryRef.

Type Parameters

  • P

Properties

type readonly

'Polygon'

Methods

toJSON

clone

() -> Polygon<P>

See also

  • polygon creates a polygon geometry from an array of linear rings coordinates

Examples

const a = fromGeoJSON({
    type: 'Polygon',
    coordinates: [
        [ [ 0, 0 ], [ 0, 1 ], [ 1, 0 ], [ 0, 0 ] ],
    ],
});
const b = polygon([ // shortcut to above
    [ [ 0, 0 ], [ 0, 1 ], [ 1, 0 ], [ 0, 0 ] ],
]);
const c = fromWKT('POLYGON ((0 0, 0 1, 1 0, 0 0))');
const d = polygon([
    [ [ 0, 0 ], [ 0, 8 ], [ 8, 0 ], [ 0, 0 ] ], // shell
    [ [ 2, 1 ], [ 1, 2 ], [ 2, 2 ], [ 2, 1 ] ], // hole 1
    [ [ 2, 2 ], [ 2, 3 ], [ 3, 2 ], [ 2, 2 ] ], // hole 2
]);

MultiPoint

edit

MultiPoint is an instance of GeometryRef that represents the multi point geometry.

MultiPoint extends GeometryRef.

Type Parameters

  • P

Properties

type readonly

'MultiPoint'

Methods

toJSON

clone

() -> MultiPoint<P>

See also

  • multiPoint creates a multi point geometry from an array of positions

Examples

const a = fromGeoJSON({
    type: 'MultiPoint',
    coordinates: [ [ 0, 0 ], [ 1, 1 ], [ 2, 2 ] ],
});
const b = multiPoint([ [ 0, 0 ], [ 1, 1 ], [ 2, 2 ] ]); // shortcut to above
const c = fromWKT('MULTIPOINT (0 0, 1 1, 2 2)');

MultiLineString

edit

MultiLineString is an instance of GeometryRef that represents the multi line string geometry.

MultiLineString extends GeometryRef.

Type Parameters

  • P

Properties

type readonly

'MultiLineString'

Methods

toJSON

clone

See also

  • multiLineString creates a multi line string geometry from an array of line strings coordinates

Examples

const a = fromGeoJSON({
    type: 'MultiLineString',
    coordinates: [
        [ [ 0, 0 ], [ 1, 1 ] ], // line 1
        [ [ 2, 2 ], [ 3, 3 ] ], // line 2
    ],
});
const b = multiLineString([ // shortcut to above
    [ [ 0, 0 ], [ 1, 1 ] ],
    [ [ 2, 2 ], [ 3, 3 ] ],
]);
const c = fromWKT('MULTILINESTRING ((0 0, 1 1), (2 2, 3 3))');

MultiPolygon

edit

MultiPolygon is an instance of GeometryRef that represents the multi polygon geometry.

MultiPolygon extends GeometryRef.

Type Parameters

  • P

Properties

type readonly

'MultiPolygon'

Methods

toJSON

clone

See also

  • multiPolygon creates a multi polygon geometry from an array of polygon coordinates

Examples

const a = fromGeoJSON({
    type: 'MultiPolygon',
    coordinates: [
        [ [ [ 0, 1 ], [ 1, 0 ], [ 1, 1 ], [ 0, 1 ] ] ], // polygon 1
        [ [ [ 1, 1 ], [ 1, 3 ], [ 3, 1 ], [ 1, 1 ] ] ], // polygon 2
    ],
});
const b = multiPolygon([ // shortcut to above
    [ [ [ 0, 1 ], [ 1, 0 ], [ 1, 1 ], [ 0, 1 ] ] ],
    [ [ [ 1, 1 ], [ 1, 3 ], [ 3, 1 ], [ 1, 1 ] ] ],
]);
const c = fromWKT('MULTIPOLYGON (((0 1, 1 0, 1 1, 0 1)), ((1 1, 1 3, 3 1, 1 1)))');

GeometryCollection

edit

GeometryCollection is an instance of GeometryRef that represents the geometry collection.

GeometryCollection extends GeometryRef.

Type Parameters

  • P

Properties

type readonly

'GeometryCollection'

Methods

toJSON

clone

See also

Examples

const a = fromGeoJSON({
    type: 'GeometryCollection',
    geometries: [
        { type: 'Point', coordinates: [ 0, 0 ] },
        { type: 'LineString', coordinates: [ [ 0, 1 ], [ 1, 0 ] ] },
    ],
});
const b = geometryCollection([
    point([ 0, 0 ]),
    lineString([ [ 0, 1 ], [ 1, 0 ] ]),
]);

CircularString

edit

CircularString extends GeometryRef.

Type Parameters

  • P

Properties

type readonly

'CircularString'

Methods

toJSON

() -> never

clone

CompoundCurve

edit

CompoundCurve extends GeometryRef.

Type Parameters

  • P

Properties

type readonly

'CompoundCurve'

Methods

toJSON

() -> never

clone

CurvePolygon

edit

CurvePolygon extends GeometryRef.

Type Parameters

  • P

Properties

type readonly

'CurvePolygon'

Methods

toJSON

() -> never

clone

MultiCurve

edit

MultiCurve extends GeometryRef.

Type Parameters

  • P

Properties

type readonly

'MultiCurve'

Methods

toJSON

() -> never

clone

() -> MultiCurve<P>

MultiSurface

edit

MultiSurface extends GeometryRef.

Type Parameters

  • P

Properties

type readonly

'MultiSurface'

Methods

toJSON

() -> never

clone