A general geometry which can represent a point, line, polygon, mulitpoint, multilinestring
A polyline object which is a closed path geometry with one or more paths.
Adds point to the last set in geometry's set collection. If the geometry is empty, a new set is added to the geometry first.
The point to add.
{ setIdx: number; idx: number; }
Object of the form {setIdx, idx} where setIdx is the 0-based index of the set the point was added to and idx is the 0-based index of the point in its set.
Creates a new polygon object from a deep copy of the underlying geometry.
Thew new cloned polygon.
Tests whether this geometry contains a given point/
The reference point.
boolean
Result of the containment test.
Creates a new polygon or polyline form the geometry according to whether the geometry is closed.
any
A new polyline or polygon geometry.
Finds point along boundary of geometry nearest to the given point
Reference point.
{ setIdx: number; ptIdx: number; pt: 'mapsjs'.point; distance: number; }
An object of the form {setIdx, ptIdx, pt, distance} where setIdx is the index of the set the point is in, ptIdx is the index of the point in the set, pt is the point object, and distance is the distance of the point to the reference point in map units.
Finds the point in this geometry nearest to the given point.
Reference point.
{ setIdx: number; ptIdx: number; pt: 'mapsjs'.point; distance: number; }
An object of the form {setIdx, ptIdx, pt, distance} where setIdx is the index of the set the point is in, ptIdx is the index of the point in the set, pt is the point object, and distance is the distance of the point to the reference point in map units.
Iterates every vertex in the geometry and passes to the supplied callback. Return true from in the callback will break the iteration.
Callback with the signature action(setIdx, idx, x, y, set).
Calculates area of a ring in a polygon by index according to the actual area. If no index is provided, uses the last ring in the polygon's ring collection.
number
Area in square meters of the ring.
Calculates perimeter of a ring in a polygon by index according to actual distance. If no index is provided, uses the last ring in the polygon's ring collection.
number
Length in meters of the perimeter of the ring.
Returns the geometry's bounding box as an envelope.
The bounding box of the geometry as an envelope.
Gets the underlying geometry of the polygon.
The polygon's underlying geometry object.
Checks whether or not this geometry is closed.
boolean
Result of the closed check.
Checks whether or not this geometry is closed.
boolean
Result of the path check.
Finds coordinates in map units of the midpoint of this geometry. If this geometry is an open path, the midpoint is the midpoint of the path. If this geometry is a closed path, the midpoint is the centroid of the polygon. If a set index is not provided, finds the labeling point for the last set in this geometry's set collection.
Midpoint of this geometry.
Calculates area of a ring in a polygon by index according to projected map cooordinates. If no index is provided, uses the last ring in the polygon's ring collection.
number
Area in square projected units of the ring.
Calculates perimeter of a ring in a polygon by index according to projected map cooordinates. If no index is provided, uses the last ring in the polygon's ring collection.
number
Length in projected units of the distance of the ring.
Gets a ring from this polygon's set collection by index, or, if no index is provided, gets the last ring.
Array<number>
A ring as an array of points in the form [xn,yn].
Gets number of rings in this polygon.
number
Number of rings.
Gets a set from this geometry's set collection by index, or, if no index is provided, gets the last set. Note: for polygons, first set is primary ring and subsequent ones are holes.
Array<number>
A set as an array of points in the form [xn,yn].
Gets the number of sets in this geometry.
number
Number of sets.
Determines whether this polygon intersects a given geometry.
Geometry to test against.
boolean
Result of the intersection test.
Tests the validity of this geometry. An open path geometry is valid if it has at least one set with at least two points. A closed geometry is valid if it has at least one set with at least three points. A point (non-path) geometry is always valid.
boolean
valid geometry is true, otherwise false.
Determines whether this polyline overlaps a given geometry.
boolean
Result of the intersection test.
Gets the last ring in the polygon's ring collection and removes it from the collection.
Array<number>
Ring removed as an array of points in the form [xn,yn].
Gets the last set in the geometry's set collection and removes it from the collection.
Array<number>
Set removed as an array of points in the form [xn,yn].
Adds a new ring to this polygon's ring collection.
Ring to add as an array of points in the form [xn,yn].
Adds a new set to this geometry's collection of sets.
Set to add as an array of points in the form [xn,yn].
Convert this polygon into an array of OGC compliant polygons where the first set is a ring and all subsequent contained sets are holes.
polygon[]
An array of OGC polygons.
Creates a wkt string from this geometry.
string
A string of well known text.
Creates SVG path data from this geometry if it is a path.
string
String of the SVG path or null the geometry is not a path.
string
A polyline object which is an open path geometry with one or more paths.
Adds point to the last set in geometry's set collection. If the geometry is empty, a new set is added to the geometry first.
The point to add.
{ setIdx: number; idx: number; }
Object of the form {setIdx, idx} where setIdx is the 0-based index of the set the point was added to and idx is the 0-based index of the point in its set.
Creates a new polyline object from a deep copy of the underlying geometry.
Thew new cloned polyline.
Tests whether this geometry contains a given point/
The reference point.
boolean
Result of the containment test.
Creates a new polygon or polyline form the geometry according to whether the geometry is closed.
any
A new polyline or polygon geometry.
Finds point along boundary of geometry nearest to the given point
Reference point.
{ setIdx: number; ptIdx: number; pt: 'mapsjs'.point; distance: number; }
An object of the form {setIdx, ptIdx, pt, distance} where setIdx is the index of the set the point is in, ptIdx is the index of the point in the set, pt is the point object, and distance is the distance of the point to the reference point in map units.
Finds the point in this geometry nearest to the given point.
Reference point.
{ setIdx: number; ptIdx: number; pt: 'mapsjs'.point; distance: number; }
An object of the form {setIdx, ptIdx, pt, distance} where setIdx is the index of the set the point is in, ptIdx is the index of the point in the set, pt is the point object, and distance is the distance of the point to the reference point in map units.
Iterates every vertex in the geometry and passes to the supplied callback. Return true from in the callback will break the iteration.
Callback with the signature action(setIdx, idx, x, y, set).
Calculates distance of a line in a polyline by index according to actual distance. If no index is provided, uses the last line in the polyline's set collection.
number
Distance in meters of the line.
Returns the geometry's bounding box as an envelope.
The bounding box of the geometry as an envelope.
Gets the underlying geometry of the polyline.
The polyline's underlying geometry object.
Checks whether or not this geometry is closed.
boolean
Result of the closed check.
Checks whether or not this geometry is closed.
boolean
Result of the path check.
Finds coordinates in map units of the midpoint of this geometry. If this geometry is an open path, the midpoint is the midpoint of the path. If this geometry is a closed path, the midpoint is the centroid of the polygon. If a set index is not provided, finds the labeling point for the last set in this geometry's set collection.
Midpoint of this geometry.
Gets a line from this polyline's liune collection by index, or, if no index is provided, gets the last line.
Array<number>
A line as an array of points in the form [xn,yn].
Gets number of lines in this polyline.
number
Number of lines.
Calculates distance of a line in a polyline by index according to projected map cooordinates. If no index is provided, uses the last line in the polyline's set collection.
number
Length in projected units of the distance of the line.
Gets a set from this geometry's set collection by index, or, if no index is provided, gets the last set. Note: for polygons, first set is primary ring and subsequent ones are holes.
Array<number>
A set as an array of points in the form [xn,yn].
Gets the number of sets in this geometry.
number
Number of sets.
Determines whether this polyline intersects a given geometry.
Geometry to test against.
boolean
Result of the intersection test.
Tests the validity of this geometry. An open path geometry is valid if it has at least one set with at least two points. A closed geometry is valid if it has at least one set with at least three points. A point (non-path) geometry is always valid.
boolean
valid geometry is true, otherwise false.
Gets the last line in the polyline's set collection and removes it from the collection.
Array<number>
Line removed as an array of points in the form [xn,yn].
Gets the last set in the geometry's set collection and removes it from the collection.
Array<number>
Set removed as an array of points in the form [xn,yn].
Adds a new line to this polyline's line collection.
Line to add as an array of points in the form [xn,yn].
Adds a new set to this geometry's collection of sets.
Set to add as an array of points in the form [xn,yn].
Creates a wkt string from this geometry.
string
A string of well known text.
Creates SVG path data from this geometry if it is a path.
string
String of the SVG path or null the geometry is not a path.
string
Adds point to the last set in geometry's set collection. If the geometry is empty, a new set is added to the geometry first.
The point to add.
{ setIdx: number; idx: number; }
Object of the form {setIdx, idx} where setIdx is the 0-based index of the set the point was added to and idx is the 0-based index of the point in its set.
Creates a deep copy of this geometry.
The new cloned geometry.
Tests whether this geometry contains a given point/
The reference point.
boolean
Result of the containment test.
Creates a new polygon or polyline form the geometry according to whether the geometry is closed.
any
A new polyline or polygon geometry.
Finds point along boundary of geometry nearest to the given point
Reference point.
{ setIdx: number; ptIdx: number; pt: 'mapsjs'.point; distance: number; }
An object of the form {setIdx, ptIdx, pt, distance} where setIdx is the index of the set the point is in, ptIdx is the index of the point in the set, pt is the point object, and distance is the distance of the point to the reference point in map units.
Finds the point in this geometry nearest to the given point.
Reference point.
{ setIdx: number; ptIdx: number; pt: 'mapsjs'.point; distance: number; }
An object of the form {setIdx, ptIdx, pt, distance} where setIdx is the index of the set the point is in, ptIdx is the index of the point in the set, pt is the point object, and distance is the distance of the point to the reference point in map units.
Iterates every vertex in the geometry and passes to the supplied callback. Return true from in the callback will break the iteration.
Callback with the signature action(setIdx, idx, x, y, set).
Returns the geometry's bounding box as an envelope.
The bounding box of the geometry as an envelope.
Checks whether or not this geometry is closed.
boolean
Result of the closed check.
Checks whether or not this geometry is closed.
boolean
Result of the path check.
Finds coordinates in map units of the midpoint of this geometry. If this geometry is an open path, the midpoint is the midpoint of the path. If this geometry is a closed path, the midpoint is the centroid of the polygon. If a set index is not provided, finds the labeling point for the last set in this geometry's set collection.
Midpoint of this geometry.
Gets a set from this geometry's set collection by index, or, if no index is provided, gets the last set. Note: for polygons, first set is primary ring and subsequent ones are holes.
Array<number>
A set as an array of points in the form [xn,yn].
Gets the number of sets in this geometry.
number
Number of sets.
Tests the validity of this geometry. An open path geometry is valid if it has at least one set with at least two points. A closed geometry is valid if it has at least one set with at least three points. A point (non-path) geometry is always valid.
boolean
valid geometry is true, otherwise false.
Gets the last set in the geometry's set collection and removes it from the collection.
Array<number>
Set removed as an array of points in the form [xn,yn].
Adds a new set to this geometry's collection of sets.
Set to add as an array of points in the form [xn,yn].
Creates a wkt string from this geometry.
string
A string of well known text.
Creates SVG path data from this geometry if it is a path.
string
String of the SVG path or null the geometry is not a path.
string