new Coordinate(x, y) [source]
var coord = new Coordinate(0, 0);
var coord = new Coordinate([ 0, 0 ]);
var coord = new Coordinate({ x : 0, y : 0 });
Parameter | Type | Description |
---|---|---|
x
|
Number | x value |
y
|
Number | y value |
Members
x
Properties:
Name | Type | Description |
---|---|---|
x
|
Number | value on X-Axis or longitude in degrees |
- Source:
y
Properties:
Name | Type | Description |
---|---|---|
y
|
Number | value on Y-Axis or Latitude in degrees |
- Source:
Static Methods
(static) toNumberArrays(coordinates) [source]
Convert one or more Coordinate objects to GeoJSON style coordinates
// result is [[100,0], [101,1]]
var numCoords = Coordinate.toNumberArrays([new Coordinate(100,0), new Coordinate(101,1)]);
Parameter | Type | Description |
---|---|---|
coordinates
|
Coordinate | Array.<Coordinate> | coordinates to convert |
Returns:
Array.<Number>|Array.<Array.<Number>>:(static) toCoordinates(coordinates) [source]
Convert one or more GeoJSON style coordiantes to Coordinate objects
var coordinates = Coordinate.toCoordinates([[100,0], [101,1]]);
Parameter | Type | Description |
---|---|---|
coordinates
|
Array.<Number> | Array.<Array.<Number>> | coordinates to convert |
Returns:
Coordinate|Array.<Coordinate>:Methods
copy() [source]
Returns a copy of the coordinate
Returns:
Coordinate: copyadd(coordinate) [source]
Returns the result of addition of another coordinate.
Parameter | Type | Description |
---|---|---|
coordinate
|
Coordinate | coordinate to add |
Returns:
Coordinate: resultsubstract(coordinate) [source]
Returns the result of subtraction of another coordinate.
Parameter | Type | Description |
---|---|---|
coordinate
|
Coordinate | coordinate to substract |
Returns:
Coordinate: resultmulti(ratio) [source]
Returns the result of multiplication of the current coordinate by the given number.
Parameter | Type | Description |
---|---|---|
ratio
|
Number | ratio to multi |
Returns:
Coordinate: resultequals(c) [source]
Compare with another coordinate to see whether they are equal.
Parameter | Type | Description |
---|---|---|
c
|
Coordinate | coordinate to compare |
Returns:
Boolean:toArray() [source]
Convert the coordinate to a number array [x, y]
Returns:
Array.<Number>: number arraytoJSON() [source]
Convert the coordinate to a json object {x : .., y : ..}