public class TurfMeasurement extends Object
Constructor and Description |
---|
TurfMeasurement() |
Modifier and Type | Method and Description |
---|---|
static com.mapbox.services.commons.geojson.Point |
along(com.mapbox.services.commons.geojson.LineString line,
double distance,
String units) |
static double[] |
bbox(com.mapbox.services.commons.geojson.LineString lineString)
Takes a set of features, calculates the bbox of all input features, and returns a bounding box.
|
static double[] |
bbox(com.mapbox.services.commons.geojson.MultiLineString multiLineString)
Takes a set of features, calculates the bbox of all input features, and returns a bounding box.
|
static double[] |
bbox(com.mapbox.services.commons.geojson.MultiPoint multiPoint)
Takes a set of features, calculates the bbox of all input features, and returns a bounding box.
|
static double[] |
bbox(com.mapbox.services.commons.geojson.MultiPolygon multiPolygon)
Takes a set of features, calculates the bbox of all input features, and returns a bounding box.
|
static double[] |
bbox(com.mapbox.services.commons.geojson.Point point)
Takes a set of features, calculates the bbox of all input features, and returns a bounding box.
|
static double[] |
bbox(com.mapbox.services.commons.geojson.Polygon polygon)
Takes a set of features, calculates the bbox of all input features, and returns a bounding box.
|
static double |
bearing(com.mapbox.services.commons.geojson.Point p1,
com.mapbox.services.commons.geojson.Point p2)
Takes two points and finds the geographic bearing between them.
|
static double |
bearing(com.mapbox.services.commons.models.Position p1,
com.mapbox.services.commons.models.Position p2)
Takes two positions and finds the geographic bearing between them.
|
static com.mapbox.services.commons.geojson.Point |
destination(com.mapbox.services.commons.geojson.Point point1,
double distance,
double bearing,
String units)
Takes a Point and calculates the location of a destination point given a distance in
degrees, radians, miles, or kilometers; and bearing in degrees.
|
static com.mapbox.services.commons.models.Position |
destination(com.mapbox.services.commons.models.Position p1,
double distance,
double bearing,
String units)
Takes a Position and calculates the location of a destination point given a distance in
degrees, radians, miles, or kilometers; and bearing in degrees.
|
static double |
distance(com.mapbox.services.commons.geojson.Point point1,
com.mapbox.services.commons.geojson.Point point2)
Calculates the distance between two points in kilometers.
|
static double |
distance(com.mapbox.services.commons.geojson.Point point1,
com.mapbox.services.commons.geojson.Point point2,
String units)
Calculates the distance between two points in degress, radians, miles, or kilometers.
|
static double |
distance(com.mapbox.services.commons.models.Position point1,
com.mapbox.services.commons.models.Position point2,
String units)
Calculates the distance between two positions in degress, radians, miles, or kilometers.
|
static double |
lineDistance(com.mapbox.services.commons.geojson.LineString lineString,
String units)
Takes a line and measures its length in the specified units.
|
static double |
lineDistance(com.mapbox.services.commons.geojson.MultiLineString multiLineString,
String units)
Takes a line and measures its length in the specified units.
|
static double |
lineDistance(com.mapbox.services.commons.geojson.MultiPolygon multiPolygon,
String units)
Takes a line and measures its length in the specified units.
|
static double |
lineDistance(com.mapbox.services.commons.geojson.Polygon polygon,
String units)
Takes a line and measures its length in the specified units.
|
static com.mapbox.services.commons.geojson.Point |
midpoint(com.mapbox.services.commons.geojson.Point from,
com.mapbox.services.commons.geojson.Point to)
Takes two
Point and returns a point midway between them. |
static com.mapbox.services.commons.models.Position |
midpoint(com.mapbox.services.commons.models.Position from,
com.mapbox.services.commons.models.Position to)
Takes two
Position and returns a position midway between them. |
public static double bearing(com.mapbox.services.commons.models.Position p1, com.mapbox.services.commons.models.Position p2)
p1
- Starting Position
.p2
- Ending Position
.public static double bearing(com.mapbox.services.commons.geojson.Point p1, com.mapbox.services.commons.geojson.Point p2)
p1
- Starting Point
.p2
- Ending Point
.public static com.mapbox.services.commons.models.Position destination(com.mapbox.services.commons.models.Position p1, double distance, double bearing, String units) throws TurfException
p1
- Starting point.distance
- Distance from the starting point.bearing
- Ranging from -180 to 180.units
- Miles, kilometers, degrees, or radians (defaults kilometers).Point
TurfException
- TurfException Signals that a Turf exception of some sort has occurred.public static com.mapbox.services.commons.geojson.Point destination(com.mapbox.services.commons.geojson.Point point1, double distance, double bearing, String units) throws TurfException
point1
- Starting point.distance
- Distance from the starting point.bearing
- Ranging from -180 to 180.units
- Miles, kilometers, degrees, or radians (defaults kilometers).Point
TurfException
- TurfException Signals that a Turf exception of some sort has occurred.public static double distance(com.mapbox.services.commons.models.Position point1, com.mapbox.services.commons.models.Position point2, String units) throws TurfException
point1
- Origin position.point2
- Destination position.units
- Miles, kilometers, degrees, or radians (defaults kilometers).TurfException
- TurfException Signals that a Turf exception of some sort has occurred.public static double distance(com.mapbox.services.commons.geojson.Point point1, com.mapbox.services.commons.geojson.Point point2) throws TurfException
point1
- Origin point.point2
- Destination point.TurfException
- TurfException Signals that a Turf exception of some sort has occurred.public static double distance(com.mapbox.services.commons.geojson.Point point1, com.mapbox.services.commons.geojson.Point point2, String units) throws TurfException
point1
- Origin point.point2
- Destination point.units
- Can be degrees, radians, miles, or kilometers (defaults kilometers).TurfException
- TurfException Signals that a Turf exception of some sort has occurred.public static double lineDistance(com.mapbox.services.commons.geojson.LineString lineString, String units) throws TurfException
lineString
- Line to measure.units
- Can be degrees, radians, miles, or kilometers (defaults kilometers).TurfException
- TurfException Signals that a Turf exception of some sort has occurred.public static double lineDistance(com.mapbox.services.commons.geojson.Polygon polygon, String units) throws TurfException
polygon
- Line to measure.units
- Can be degrees, radians, miles, or kilometers (defaults kilometers).TurfException
- TurfException Signals that a Turf exception of some sort has occurred.public static double lineDistance(com.mapbox.services.commons.geojson.MultiLineString multiLineString, String units) throws TurfException
multiLineString
- Line to measure.units
- Can be degrees, radians, miles, or kilometers (defaults kilometers).TurfException
- TurfException Signals that a Turf exception of some sort has occurred.public static double lineDistance(com.mapbox.services.commons.geojson.MultiPolygon multiPolygon, String units) throws TurfException
multiPolygon
- Line to measure.units
- Can be degrees, radians, miles, or kilometers (defaults kilometers).TurfException
- TurfException Signals that a Turf exception of some sort has occurred.public static com.mapbox.services.commons.models.Position midpoint(com.mapbox.services.commons.models.Position from, com.mapbox.services.commons.models.Position to) throws TurfException
Position
and returns a position midway between them. The midpoint is
calculated geodesically, meaning the curvature of the earth is taken into account.from
- First point.to
- Second point.Position
midway between pt1 and pt2.TurfException
- TurfException Signals that a Turf exception of some sort has occurred.public static com.mapbox.services.commons.geojson.Point midpoint(com.mapbox.services.commons.geojson.Point from, com.mapbox.services.commons.geojson.Point to) throws TurfException
Point
and returns a point midway between them. The midpoint is calculated
geodesically, meaning the curvature of the earth is taken into account.from
- First point.to
- Second point.Point
midway between pt1 and pt2.TurfException
- TurfException Signals that a Turf exception of some sort has occurred.public static com.mapbox.services.commons.geojson.Point along(com.mapbox.services.commons.geojson.LineString line, double distance, String units) throws TurfException
TurfException
public static double[] bbox(com.mapbox.services.commons.geojson.Point point)
point
- A Point
object.[minX, minY, maxX, maxY]
.public static double[] bbox(com.mapbox.services.commons.geojson.LineString lineString)
lineString
- A LineString
object.[minX, minY, maxX, maxY]
.public static double[] bbox(com.mapbox.services.commons.geojson.MultiPoint multiPoint)
multiPoint
- A MultiPoint
object.[minX, minY, maxX, maxY]
.public static double[] bbox(com.mapbox.services.commons.geojson.Polygon polygon)
polygon
- A Polygon
object.[minX, minY, maxX, maxY]
.public static double[] bbox(com.mapbox.services.commons.geojson.MultiLineString multiLineString)
multiLineString
- A MultiLineString
object.[minX, minY, maxX, maxY]
.public static double[] bbox(com.mapbox.services.commons.geojson.MultiPolygon multiPolygon)
multiPolygon
- A MultiPolygon
object.[minX, minY, maxX, maxY]
.© 2015–2016 Mapbox. All rights reserved.