Constructor
new $g.MultiLineString(…lineStrings)
Constructs a new MultiLineString object from the given line strings with the same spatial reference.
Name | Type | Attributes | Description |
---|---|---|---|
lineStrings | $g. | <repeatable> | The geometries for this collection. |
- Since
- 6.0.0
If any argument is not a $g.Geometry object that matches the collection type.
If the geometrie's spatial references do not match.
Extends
Members
(readonly) geometries :Array.<$g.Geometry>
The geometries collected in this collection.
- Array.<$g.Geometry>
- Since
- 6.0.0
- Inherited From
(readonly) is3D :boolean
true iff the geometry has a z component.
- boolean
- Since
- 6.0.0
- Inherited From
(readonly) isGeographic :boolean
true if the geometry is geographic, false if it is geometric.
- boolean
- Since
- 6.0.0
- Inherited From
(readonly) isMeasured :boolean
true iff the geometry has a measurement component.
- boolean
- Since
- 6.0.0
- Inherited From
(readonly) isProjected :boolean
true iff the geometry is geographic and the underlying coordinate system is a projected reference system.
- boolean
- Since
- 6.0.0
- Inherited From
(nullable) srid :integer
Spatial reference id for geographic geometries or null for cartesian geometries.
- integer
- Since
- 6.0.0
- Inherited From
Methods
contains(geometry) → {boolean}
Tests if the given geometry lies completely inside this geometry, using the Dimensionally Extended 9-Intersection Model (DE-9IM), ignoring any z values.
Name | Type | Description |
---|---|---|
geometry | $g. | The geometry to compare this object to. It should have the same SRID. |
- Since
- 6.0.0
- Inherited From
- Type:
- boolean
convexHull() → {$g.Polygon}
Constructs a polygon that represents the convex hull of all points that are inside this geometry.
- Since
- 6.0.0
- Inherited From
- Type:
- $g.
Polygon
crosses(geometry) → {boolean}
Tests if the given geometry crosses this geometry, using the Dimensionally Extended 9-Intersection Model (DE-9IM), ignoring any z values.
Name | Type | Description |
---|---|---|
geometry | $g. | The geometry to compare this object to. It should have the same SRID. |
- Since
- 6.0.0
- Inherited From
- Type:
- boolean
disjoint(geometry) → {boolean}
Tests if the given geometry lies completely outside this geometry, using the Dimensionally Extended 9-Intersection Model (DE-9IM), ignoring any z values.
Name | Type | Description |
---|---|---|
geometry | $g. | The geometry to compare this object to. It should have the same SRID. |
- Since
- 6.0.0
- Inherited From
- Type:
- boolean
distance(geometry) → {number}
Calculates the shortest distance from any point of this geometry to any point of the parameter. The return value is only really useful for cartesian or projected geographic geometries. For geometries with geodetic coordinates, use .geodesicDistance().
Name | Type | Description |
---|---|---|
geometry | $g. | The geometry to calculate the distance to. It should have the same SRID. |
- Since
- 6.0.0
- Inherited From
If the argument is not a valid geometry
The distance in the natural distance unit defined by the reference system
- Type:
- number
equals(value) → {boolean}
Returns true if the values are equal
Name | Type | Description |
---|---|---|
value | Another attribute value |
- Inherited From
- Type:
- boolean
geodesicDistance(geometry) → {number}
Calculates the shortest geodesic distance from any point of this geometry to any point of the parameter. The return value is only really useful for geodetic geometries. For geometries with cartesic or projected coordinates, use .distance().
Name | Type | Description |
---|---|---|
geometry | $g. | The geometry to calculate the distance to. It must have the same SRID. |
- Since
- 6.0.0
- Inherited From
If the argument is not a valid geometry, the SRIDs do not match or the geometries are not geodetic.
If the computation is not possible due to missing libraries.
The geodesic distance in meters
- Type:
- number
intersects(geometry) → {boolean}
Tests if the given geometry intersects this geometry, using the Dimensionally Extended 9-Intersection Model (DE-9IM), ignoring any z values.
Name | Type | Description |
---|---|---|
geometry | $g. | The geometry to compare this object to. It should have the same SRID. |
- Since
- 6.0.0
- Inherited From
- Type:
- boolean
overlaps(geometry) → {boolean}
Tests if the given geometry has some (but not all) points in common with this geometry, using the Dimensionally Extended 9-Intersection Model (DE-9IM), ignoring any z values.
Name | Type | Description |
---|---|---|
geometry | $g. | The geometry to compare this object to. It should have the same SRID. |
- Since
- 6.0.0
- Inherited From
- Type:
- boolean
relate(geometry) → {string}
Calculates a string representation of the Clementini-Matrix resulting from applying the Dimensionally Extended 9-Intersection Model (DE-9IM) to this geometry and the parameter.
Name | Type | Description |
---|---|---|
geometry | $g. | The geometry to compare this object to. It should have the same SRID. |
- Since
- 6.0.0
- Inherited From
- Type:
- string
$g.Geometry.fromWKT('LINESTRING (0 0, 5 5)').relate($g.Geometry.fromWKT('LINESTRING (0 5, 5 0)')) // returns '0F1FF0102'
relates(geometry, pattern) → {boolean}
Calculates with the Dimensionally Extended 9-Intersection Model (DE-9IM) whether the relation between this geometry and the first parameter matches the pattern string.
Name | Type | Description |
---|---|---|
geometry | $g. | The geometry to compare this object to. It should have the same SRID. |
pattern | string | A 9 letter string over the alphabet {0, 1, 2, T, F, *}. |
- Since
- 6.0.0
- Inherited From
- Type:
- boolean
$g.Geometry.fromWKT('LINESTRING (0 0, 5 5)').relates($g.Geometry.fromWKT('LINESTRING (0 5, 5 0)'), '0F1FF0102') // returns true
setSRID(sridopt)
Set the spatial reference id for the geometry
Name | Type | Attributes | Description |
---|---|---|---|
srid | number | <optional> | Spatial reference id or undefined for cartesian geometry |
- Since
- 6.0.0
- Inherited From
toGeoJSON() → {object}
Creates a GeoJSON object from this geometry.
- Since
- 6.0.0
- Inherited From
If this geometry cannot be represented as GeoJSON, e.g. because of empty points.
GeoJSON object.
- Type:
- object
const geoJSON = new $g.Point(10, 20).toGeoJSON() // { type: 'Point', coordinates: [10, 20] }
JSON.stringify(geoJSON) // To get the JSON string, use JSON.stringify
touches(geometry) → {boolean}
Tests if the given geometry touches (but does not intersect) this geometry, using the Dimensionally Extended 9-Intersection Model (DE-9IM), ignoring any z values.
Name | Type | Description |
---|---|---|
geometry | $g. | The geometry to compare this object to. It should have the same SRID. |
- Since
- 6.0.0
- Inherited From
- Type:
- boolean
toWKB(extendedopt) → {Array.<number>}
(Extended) WKB byte representation of this geometry.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
extended | boolean | <optional> | true | Include extended bytes for SRID |
- Since
- 6.0.0
- Inherited From
Byte array
- Type:
- Array.<number>
toWKT(extendedopt) → {string}
(Extended) WKT string representation of this geometry.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
extended | boolean | <optional> | true | Include SRID tag |
- Since
- 6.0.0
- Inherited From
- Type:
- string
new $g.LineString(new $g.Point(0, 1), new $g.Point(2, 3)).toWKT() // A line string with cartesian coordinates starting from 0,1 ending at 2,3: LINESTRING (0 1, 2 3)
new $g.Point(9, 50, 4326).toWKT() // A point with WGS84 (EPSG ID 4326) latitude 50°N and longitude 9°E: SRID=4326;POINT (9 50)
transformTo(targetSRID) → {$g.Geometry}
Transforms the geometry to another coordinate reference system and returns a new geometry. Depending on the source and target reference system, this may result in a loss of accuracy.
Name | Type | Description |
---|---|---|
targetSRID | number | The identifier of the target coordinate reference system. |
- Since
- 6.0.0
- Inherited From
If this geometry has no coordinate reference system, or the source or target reference system is invalid
An equivalent geometry in the coordinate reference system identified by the given SRID.
- Type:
- $g.
Geometry
within(geometry) → {boolean}
Tests if this geometry lies completely inside the given geometry, using the Dimensionally Extended 9-Intersection Model (DE-9IM), ignoring any z values.
Name | Type | Description |
---|---|---|
geometry | $g. | The geometry to compare this object to. It should have the same SRID. |
- Since
- 6.0.0
- Inherited From
- Type:
- boolean