Type Definitions
Geometry
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
Point
Point is an instance of GeometryRef
that represents the point geometry.
Point
extends GeometryRef
.
Type Parameters
-
P
Properties
type
readonly
'Point'
Methods
toJSON
() -> GeoJSON_Feature<GeoJSON_Point, P>
clone
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
LineString is an instance of GeometryRef
that represents the line string geometry.
LineString
extends GeometryRef
.
Type Parameters
-
P
Properties
type
readonly
'LineString'
Methods
toJSON
() -> GeoJSON_Feature<GeoJSON_LineString, P>
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
LinearRing
extends GeometryRef
.
Type Parameters
-
P
Properties
type
readonly
'LinearRing'
Methods
toJSON
() -> never
clone
() -> LinearRing<P>
Polygon
Polygon is an instance of GeometryRef
that represents the polygon geometry.
Polygon
extends GeometryRef
.
Type Parameters
-
P
Properties
type
readonly
'Polygon'
Methods
toJSON
() -> GeoJSON_Feature<GeoJSON_Polygon, P>
clone
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
MultiPoint is an instance of GeometryRef
that represents the multi point geometry.
MultiPoint
extends GeometryRef
.
Type Parameters
-
P
Properties
type
readonly
'MultiPoint'
Methods
toJSON
() -> GeoJSON_Feature<GeoJSON_MultiPoint, P>
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
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
() -> GeoJSON_Feature<GeoJSON_MultiLineString, P>
clone
() -> MultiLineString<P>
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
MultiPolygon is an instance of GeometryRef
that represents the multi polygon geometry.
MultiPolygon
extends GeometryRef
.
Type Parameters
-
P
Properties
type
readonly
'MultiPolygon'
Methods
toJSON
() -> GeoJSON_Feature<GeoJSON_MultiPolygon, P>
clone
() -> MultiPolygon<P>
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
GeometryCollection is an instance of GeometryRef
that represents the geometry collection.
GeometryCollection
extends GeometryRef
.
Type Parameters
-
P
Properties
type
readonly
'GeometryCollection'
Methods
toJSON
clone
() -> GeometryCollection<P>
See also
geometryCollection
creates a geometry collection from an array of geometries
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
CircularString
extends GeometryRef
.
Type Parameters
-
P
Properties
type
readonly
'CircularString'
Methods
toJSON
() -> never
clone
() -> CircularString<P>
CompoundCurve
CompoundCurve
extends GeometryRef
.
Type Parameters
-
P
Properties
type
readonly
'CompoundCurve'
Methods
toJSON
() -> never
clone
() -> CompoundCurve<P>
CurvePolygon
CurvePolygon
extends GeometryRef
.
Type Parameters
-
P
Properties
type
readonly
'CurvePolygon'
Methods
toJSON
() -> never
clone
() -> CurvePolygon<P>
MultiCurve
MultiCurve
extends GeometryRef
.
Type Parameters
-
P
Properties
type
readonly
'MultiCurve'
Methods
toJSON
() -> never
clone
() -> MultiCurve<P>
MultiSurface
MultiSurface
extends GeometryRef
.
Type Parameters
-
P
Properties
type
readonly
'MultiSurface'
Methods
toJSON
() -> never
clone
() -> MultiSurface<P>