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
G & { [ __PREPARED__ ]: true }
Branded type representing one of geometries that was prepared.
Geometry preparation is especially useful when a certain geometry will be compared many times with other geometries when computing spatial predicates or calculating distances.
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
pointcreates 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
lineStringcreates 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
() -> GeoJSON_Feature<GeoJSON_LineString, P>
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
polygoncreates 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
multiPointcreates 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
multiLineStringcreates 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
multiPolygoncreates 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
() -> JSON_Feature<JSON_GeometryCollection, P>
clone
() -> GeometryCollection<P>
See also
geometryCollectioncreates 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
() -> JSON_Feature<JSON_CircularString, P>
clone
() -> CircularString<P>
CompoundCurve
CompoundCurve extends GeometryRef.
Type Parameters
-
P
Properties
type readonly
'CompoundCurve'
Methods
toJSON
() -> JSON_Feature<JSON_CompoundCurve, P>
clone
() -> CompoundCurve<P>
CurvePolygon
CurvePolygon extends GeometryRef.
Type Parameters
-
P
Properties
type readonly
'CurvePolygon'
Methods
toJSON
() -> JSON_Feature<JSON_CurvePolygon, P>
clone
() -> CurvePolygon<P>
MultiCurve
MultiCurve extends GeometryRef.
Type Parameters
-
P
Properties
type readonly
'MultiCurve'
Methods
toJSON
() -> JSON_Feature<JSON_MultiCurve, P>
clone
() -> MultiCurve<P>
MultiSurface
MultiSurface extends GeometryRef.
Type Parameters
-
P
Properties
type readonly
'MultiSurface'
Methods
toJSON
() -> JSON_Feature<JSON_MultiSurface, P>
clone
() -> MultiSurface<P>
JSON_FeatureCollection
Similar to the GeoJSON_FeatureCollection but allows for more geometry types.
Type Parameters
-
G- The type of JSON geometry -
P
Properties
type
'FeatureCollection'
features
JSON_Feature<G, P>[]
JSON_Feature
Similar to the GeoJSON_Feature but allows for more geometry types.
Type Parameters
-
G- The type of JSON geometry -
P
Properties
type
'Feature'
geometry
id optional
string | number | undefined
properties
JSON_Geometry
GeoJSON_Point | GeoJSON_LineString | GeoJSON_Polygon | GeoJSON_MultiPoint | GeoJSON_MultiLineString | GeoJSON_MultiPolygon | JSON_GeometryCollection | JSON_CircularString | JSON_CompoundCurve | JSON_CurvePolygon | JSON_MultiCurve | JSON_MultiSurface
Union type of JSON representation of all geometry types supported by GEOS.
JSON_GeometryCollection
Similar to the GeoJSON_GeometryCollection but allows for more geometry types.
Type Parameters
G- The type of JSON geometry
Properties
type
'GeometryCollection'
geometries
G[]