Class: GeoPoints

GeoPoints()

A group of ordered geographic points.

Constructor

new GeoPoints()

Since:
  • 2.27.0
Source:

Extends

  • Backbone.Collection

Members

model :Backbone.Model

The class/model that this collection contains.
Type:
  • Backbone.Model
Source:

Methods

addPoint(point) → {GeoPoint}

Add a point to the collection. Use this rather than the Backbone add method to allow for different formats of points to be added.
Parameters:
Name Type Description
point Array | Object | GeoPoint See formatPoint for accepted formats.
Source:
Returns:
Returns the GeoPoint model that was added.
Type
GeoPoint

asMapWidgetCoords() → {Array}

Convert the collection to an array of coordinates in the format native to the map widget. For Cesium, this is an array of Cartesian3 objects in ECEF coordinates.
Source:
Returns:
An array of coordinates that can be used by the map widget.
Type
Array

formatPoint(point) → {Object|GeoPoint}

Given a point in various formats, format it such that it can be used to add to this collection.
Parameters:
Name Type Description
point Array | Object | GeoPoint Accepted formats are: - An array of the form [longitude, latitude], with an optional third element for height - An object with a "longitude" and "latitude" property, and optionally a "height" property - A GeoPoint model
Source:
Returns:
Returns an object with "longitude" and "latitude" properties, and optionally a "height" property, or a GeoPoint model.
Type
Object | GeoPoint

getCZMLHeader() → {Object}

Get the header object for a CZML document.
Source:
Returns:
Returns a CZML header object.
Type
Object

getCZMLLineString() → {Object}

Convert the collection to a CZML line string object.
Source:
Returns:
Returns a CZML line string object.
Type
Object

getCZMLPolygon() → {Object}

Convert the collection to a CZML polygon object.
Source:
Returns:
Returns a CZML polygon object.
Type
Object

removePoint(indexOrPoint) → {GeoPoint}

Remove a specific point from the collection. Use this rather than the Backbone remove method to allow for different formats of points to be removed.
Parameters:
Name Type Description
indexOrPoint Array | Object | GeoPoint | Number The index of the point to remove, or the point itself. See formatPoint for accepted formats.
Source:
Returns:
Returns the GeoPoint model that was removed.
Type
GeoPoint

removePointByAttr(point) → {GeoPoint}

Remove a point from the collection based on its attributes.
Parameters:
Name Type Description
point Array | Object | GeoPoint Any format supported by formatPoint is accepted.
Source:
Returns:
Returns the GeoPoint model that was removed.
Type
GeoPoint

removePointByIndex(index) → {GeoPoint}

Remove a point from the collection based on its index.
Parameters:
Name Type Description
index Number The index of the point to remove.
Source:
Returns:
Returns the GeoPoint model that was removed.
Type
GeoPoint

to2DArray() → {Array.<Array>}

Convert the collection to an array of arrays, where each sub-array contains the longitude and latitude of a point.
Source:
Returns:
Returns an array of arrays.
Type
Array.<Array>

toCZMLPoints() → {Array.<Object>}

Convert the collection to an array of CZML point objects.
Source:
Returns:
Returns an array of CZML point objects.
Type
Array.<Object>

toCzml(geometryType, forceAsPolygonopt) → {Array.<Object>}

Convert the collection to a CZML document.
Parameters:
Name Type Attributes Default Description
geometryType String The type of geometry to create.
forceAsPolygon Boolean <optional>
false Set to true to enforce the output as a polygon for the "Polygon" geometry type, regardless of the number of points in the collection.
Source:
Returns:
Returns an array of CZML objects.
Type
Array.<Object>

toECEFArray() → {Array}

Convert the collection to a cartesian array, where each every three elements represents the x, y, and z coordinates of a vertex, e.g. [x1, y1, z1, x2, y2, z2, ...].
Source:
Returns:
Returns an array of numbers.
Type
Array

toGeoJson(geometryType, forceAsPolygonopt) → {Object}

Convert the collection to a GeoJSON object. The output can be the series of points as Point features, the points connected as a LineString feature, or the points connected and closed as a Polygon. Note: For a "Polygon" geometry type, when there's only one point in the collection, the output will be a "Point". If there are only two points, the output will be a "LineString", unless `forceAsPolygon` is set to true.
Parameters:
Name Type Attributes Default Description
geometryType String The type of geometry to create. Can be "Point", "LineString", or "Polygon".
forceAsPolygon Boolean <optional>
false Set to true to enforce the output as a polygon for the "Polygon" geometry type, regardless of the number of points in the collection.
Source:
Returns:
Returns a GeoJSON object of type "Point", "LineString", or "Polygon".
Type
Object

toGeoJsonFeatures(geometryType) → {Array.<Object>}

Convert the collection to a GeoJSON object. The output can be the series of points as Point features, the points connected as a LineString feature, or the points connected and closed as a Polygon.
Parameters:
Name Type Description
geometryType "Point" | "LineString" | "Polygon" The type of geometry to create.
Source:
Returns:
Returns an array of GeoJSON features.
Type
Array.<Object>

toGeoJsonLineStringFeature() → {Object}

Convert the collection to a GeoJSON LineString feature.
Source:
Returns:
Returns a GeoJSON LineString feature.
Type
Object

toGeoJsonPointFeatures() → {Array.<Object>}

Convert the collection to an array of GeoJSON point features.
Source:
Returns:
Returns an array of GeoJSON point features.
Type
Array.<Object>

toGeoJsonPolygonFeature() → {Object}

Convert the collection to a GeoJSON Polygon feature. The polygon will be closed if it isn't already.
Source:
Returns:
Returns a GeoJSON Polygon feature.
Type
Object