public final class TurfMeasurement
extends java.lang.Object
| Modifier and Type | Field and Description | 
|---|---|
| static double | EARTH_RADIUSEarth's radius in meters. | 
| Modifier and Type | Method and Description | 
|---|---|
| static com.mapbox.geojson.Point | along(com.mapbox.geojson.LineString line,
     double distance,
     java.lang.String units)Takes a line and returns a point at a specified distance along the line. | 
| static com.mapbox.geojson.Point | along(java.util.List<com.mapbox.geojson.Point> coords,
     double distance,
     java.lang.String units)Takes a list of points and returns a point at a specified distance along the line. | 
| static double | area(com.mapbox.geojson.Feature feature)Takes one  Featureand returns it's area in square meters. | 
| static double | area(com.mapbox.geojson.FeatureCollection featureCollection)Takes one  FeatureCollectionand returns it's area in square meters. | 
| static double | area(com.mapbox.geojson.Geometry geometry)Takes one  Geometryand returns its area in square meters. | 
| static double[] | bbox(com.mapbox.geojson.Feature feature)Takes a set of features, calculates the bbox of all input features, and returns a bounding box. | 
| static double[] | bbox(com.mapbox.geojson.FeatureCollection featureCollection)Takes a set of features, calculates the bbox of all input features, and returns a bounding box. | 
| static double[] | bbox(com.mapbox.geojson.GeoJson geoJson)Takes a set of features, calculates the bbox of all input features, and returns a bounding box. | 
| static double[] | bbox(com.mapbox.geojson.Geometry geometry)Takes an arbitrary  Geometryand calculates a bounding box. | 
| static double[] | bbox(com.mapbox.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.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.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.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.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.geojson.Polygon polygon)Takes a set of features, calculates the bbox of all input features, and returns a bounding box. | 
| static com.mapbox.geojson.Feature | bboxPolygon(com.mapbox.geojson.BoundingBox boundingBox)Takes a  BoundingBoxand uses its coordinates to create aPolygongeometry. | 
| static com.mapbox.geojson.Feature | bboxPolygon(com.mapbox.geojson.BoundingBox boundingBox,
           com.google.gson.JsonObject properties,
           java.lang.String id)Takes a  BoundingBoxand uses its coordinates to create aPolygongeometry. | 
| static com.mapbox.geojson.Feature | bboxPolygon(double[] bbox)Takes a bbox and uses its coordinates to create a  Polygongeometry. | 
| static com.mapbox.geojson.Feature | bboxPolygon(double[] bbox,
           com.google.gson.JsonObject properties,
           java.lang.String id)Takes a bbox and uses its coordinates to create a  Polygongeometry. | 
| static double | bearing(com.mapbox.geojson.Point point1,
       com.mapbox.geojson.Point point2)Takes two  Points and finds the geographic bearing between them. | 
| static com.mapbox.geojson.Feature | center(com.mapbox.geojson.Feature feature)Takes a  Featureand returns the absolute center of theFeature. | 
| static com.mapbox.geojson.Feature | center(com.mapbox.geojson.FeatureCollection featureCollection)Takes  FeatureCollectionand returns the absolute center
 of theFeatures in theFeatureCollection. | 
| static com.mapbox.geojson.Feature | center(com.mapbox.geojson.FeatureCollection featureCollection,
      com.google.gson.JsonObject properties,
      java.lang.String id)Takes  FeatureCollectionand returns the absolute center
 of theFeatures in theFeatureCollection. | 
| static com.mapbox.geojson.Feature | center(com.mapbox.geojson.Feature feature,
      com.google.gson.JsonObject properties,
      java.lang.String id)Takes a  Featureand returns the absolute center of theFeature. | 
| static com.mapbox.geojson.Point | destination(com.mapbox.geojson.Point point,
           double distance,
           double bearing,
           java.lang.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 double | distance(com.mapbox.geojson.Point point1,
        com.mapbox.geojson.Point point2)Calculates the distance between two points in kilometers. | 
| static double | distance(com.mapbox.geojson.Point point1,
        com.mapbox.geojson.Point point2,
        java.lang.String units)Calculates the distance between two points in degress, radians, miles, or kilometers. | 
| static com.mapbox.geojson.Polygon | envelope(com.mapbox.geojson.GeoJson geoJson)Takes any number of features and returns a rectangular Polygon that encompasses all vertices. | 
| static double | length(com.mapbox.geojson.LineString lineString,
      java.lang.String units)Takes a  LineStringand measures its length in the specified units. | 
| static double | length(java.util.List<com.mapbox.geojson.Point> coords,
      java.lang.String units)Takes a  ListofPointand measures its length in the specified units. | 
| static double | length(com.mapbox.geojson.MultiLineString multiLineString,
      java.lang.String units)Takes a  MultiLineStringand measures its length in the specified units. | 
| static double | length(com.mapbox.geojson.MultiPolygon multiPolygon,
      java.lang.String units)Takes a  MultiPolygonand measures each polygons perimeter in the specified units. | 
| static double | length(com.mapbox.geojson.Polygon polygon,
      java.lang.String units)Takes a  Polygonand measures its perimeter in the specified units. | 
| static com.mapbox.geojson.Point | midpoint(com.mapbox.geojson.Point from,
        com.mapbox.geojson.Point to)Takes two  Points and returns a point midway between them. | 
| static com.mapbox.geojson.BoundingBox | square(com.mapbox.geojson.BoundingBox boundingBox)Takes a bounding box and calculates the minimum square bounding box
 that would contain the input. | 
public static double bearing(@NonNull
                             com.mapbox.geojson.Point point1,
                             @NonNull
                             com.mapbox.geojson.Point point2)
Points and finds the geographic bearing between them.point1 - first point used for calculating the bearingpoint2 - second point used for calculating the bearing@NonNull
public static com.mapbox.geojson.Point destination(@NonNull
                                                            com.mapbox.geojson.Point point,
                                                            double distance,
                                                            double bearing,
                                                            @NonNull
                                                            java.lang.String units)
point - starting point used for calculating the destinationdistance - distance from the starting pointbearing - ranging from -180 to 180 in decimal degreesunits - one of the units found inside TurfConstants.TurfUnitCriteriaPoint result where you specifiedpublic static double distance(@NonNull
                              com.mapbox.geojson.Point point1,
                              @NonNull
                              com.mapbox.geojson.Point point2)
point1 - first point used for calculating the bearingpoint2 - second point used for calculating the bearingpublic static double distance(@NonNull
                              com.mapbox.geojson.Point point1,
                              @NonNull
                              com.mapbox.geojson.Point point2,
                              @NonNull
                              java.lang.String units)
point1 - first point used for calculating the bearingpoint2 - second point used for calculating the bearingunits - one of the units found inside TurfConstants.TurfUnitCriteriapublic static double length(@NonNull
                            com.mapbox.geojson.LineString lineString,
                            @NonNull
                            java.lang.String units)
LineString and measures its length in the specified units.lineString - geometry to measureunits - one of the units found inside TurfConstants.TurfUnitCriteriapublic static double length(@NonNull
                            com.mapbox.geojson.MultiLineString multiLineString,
                            @NonNull
                            java.lang.String units)
MultiLineString and measures its length in the specified units.multiLineString - geometry to measureunits - one of the units found inside TurfConstants.TurfUnitCriteriapublic static double length(@NonNull
                            com.mapbox.geojson.Polygon polygon,
                            @NonNull
                            java.lang.String units)
Polygon and measures its perimeter in the specified units. if the polygon
 contains holes, the perimeter will also be included.polygon - geometry to measureunits - one of the units found inside TurfConstants.TurfUnitCriteriapublic static double length(@NonNull
                            com.mapbox.geojson.MultiPolygon multiPolygon,
                            @NonNull
                            java.lang.String units)
MultiPolygon and measures each polygons perimeter in the specified units. if
 one of the polygons contains holes, the perimeter will also be included.multiPolygon - geometry to measureunits - one of the units found inside TurfConstants.TurfUnitCriteriapublic static double length(java.util.List<com.mapbox.geojson.Point> coords,
                            java.lang.String units)
List of Point and measures its length in the specified units.coords - geometry to measureunits - one of the units found inside TurfConstants.TurfUnitCriteriapublic static com.mapbox.geojson.Point midpoint(@NonNull
                                                com.mapbox.geojson.Point from,
                                                @NonNull
                                                com.mapbox.geojson.Point to)
Points 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 used for calculating the midpointto - second point used for calculating the midpointPoint midway between point1 and point2public static com.mapbox.geojson.Point along(@NonNull
                                             com.mapbox.geojson.LineString line,
                                             double distance,
                                             @NonNull
                                             java.lang.String units)
line - that the point should be placed upondistance - along the linestring geometry which the point should be placed onunits - one of the units found inside TurfConstants.TurfUnitCriteriaPoint which is on the linestring provided and at the distance from
         the origin of that line to the end of the distancepublic static com.mapbox.geojson.Point along(@NonNull
                                             java.util.List<com.mapbox.geojson.Point> coords,
                                             double distance,
                                             @NonNull
                                             java.lang.String units)
coords - that the point should be placed upondistance - along the linestring geometry which the point should be placed onunits - one of the units found inside TurfConstants.TurfUnitCriteriaPoint which is on the linestring provided and at the distance from
         the origin of that line to the end of the distancepublic static double[] bbox(@NonNull
                            com.mapbox.geojson.Point point)
point - a Point object[minX, minY, maxX, maxY]public static double[] bbox(@NonNull
                            com.mapbox.geojson.LineString lineString)
lineString - a LineString object[minX, minY, maxX, maxY]public static double[] bbox(@NonNull
                            com.mapbox.geojson.MultiPoint multiPoint)
multiPoint - a MultiPoint object[minX, minY, maxX, maxY]public static double[] bbox(@NonNull
                            com.mapbox.geojson.Polygon polygon)
polygon - a Polygon object[minX, minY, maxX, maxY]public static double[] bbox(@NonNull
                            com.mapbox.geojson.MultiLineString multiLineString)
multiLineString - a MultiLineString object[minX, minY, maxX, maxY]public static double[] bbox(com.mapbox.geojson.MultiPolygon multiPolygon)
multiPolygon - a MultiPolygon object[minX, minY, maxX, maxY]public static double[] bbox(com.mapbox.geojson.GeoJson geoJson)
geoJson - a GeoJson object[minX, minY, maxX, maxY]public static double[] bbox(com.mapbox.geojson.FeatureCollection featureCollection)
featureCollection - a FeatureCollection object[minX, minY, maxX, maxY]public static double[] bbox(com.mapbox.geojson.Feature feature)
feature - a Feature object[minX, minY, maxX, maxY]public static double[] bbox(com.mapbox.geojson.Geometry geometry)
Geometry and calculates a bounding box.geometry - a Geometry object[minX, minY, maxX, maxY]public static com.mapbox.geojson.Feature bboxPolygon(@NonNull
                                                     com.mapbox.geojson.BoundingBox boundingBox)
BoundingBox and uses its coordinates to create a Polygon
 geometry.boundingBox - a BoundingBox object to calculate withFeature objectpublic static com.mapbox.geojson.Feature bboxPolygon(@NonNull
                                                     com.mapbox.geojson.BoundingBox boundingBox,
                                                     @Nullable
                                                     com.google.gson.JsonObject properties,
                                                     @Nullable
                                                     java.lang.String id)
BoundingBox and uses its coordinates to create a Polygon
 geometry.boundingBox - a BoundingBox object to calculate withproperties - a JsonObject containing the feature propertiesid - common identifier of this featureFeature objectpublic static com.mapbox.geojson.Feature bboxPolygon(@NonNull
                                                     double[] bbox)
Polygon geometry.bbox - a double[] object to calculate withFeature objectpublic static com.mapbox.geojson.Feature bboxPolygon(@NonNull
                                                     double[] bbox,
                                                     @Nullable
                                                     com.google.gson.JsonObject properties,
                                                     @Nullable
                                                     java.lang.String id)
Polygon geometry.bbox - a double[] object to calculate withproperties - a JsonObject containing the feature propertiesid - common identifier of this featureFeature objectpublic static com.mapbox.geojson.Polygon envelope(com.mapbox.geojson.GeoJson geoJson)
geoJson - input featurespublic static com.mapbox.geojson.BoundingBox square(@NonNull
                                                    com.mapbox.geojson.BoundingBox boundingBox)
boundingBox - extent in west, south, east, north orderpublic static double area(@NonNull
                          com.mapbox.geojson.Feature feature)
Feature and returns it's area in square meters.feature - input Featurepublic static double area(@NonNull
                          com.mapbox.geojson.FeatureCollection featureCollection)
FeatureCollection and returns it's area in square meters.featureCollection - input FeatureCollectionpublic static double area(@NonNull
                          com.mapbox.geojson.Geometry geometry)
Geometry and returns its area in square meters.geometry - input Geometrypublic static com.mapbox.geojson.Feature center(com.mapbox.geojson.Feature feature,
                                                @Nullable
                                                com.google.gson.JsonObject properties,
                                                @Nullable
                                                java.lang.String id)
Feature and returns the absolute center of the Feature.feature - the single Feature to find the center of.properties - a optional JsonObject containing the properties that should be
                   placed in the returned Feature.id - an optional common identifier that should be placed in the returned Feature.Feature with a Point geometry type.public static com.mapbox.geojson.Feature center(com.mapbox.geojson.Feature feature)
Feature and returns the absolute center of the Feature.feature - the single Feature to find the center of.Feature with a Point geometry type.public static com.mapbox.geojson.Feature center(com.mapbox.geojson.FeatureCollection featureCollection,
                                                @Nullable
                                                com.google.gson.JsonObject properties,
                                                @Nullable
                                                java.lang.String id)
FeatureCollection and returns the absolute center
 of the Features in the FeatureCollection.featureCollection - the single FeatureCollection to find the center of.properties - a optional JsonObject containing the properties that should be
                   placed in the returned Feature.id - an optional common identifier that should be placed in the returned Feature.Feature with a Point geometry type.public static com.mapbox.geojson.Feature center(com.mapbox.geojson.FeatureCollection featureCollection)
FeatureCollection and returns the absolute center
 of the Features in the FeatureCollection.featureCollection - the single FeatureCollection to find the center of.Feature with a Point geometry type.