public class GeoUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static double |
DEG_TO_RAD |
private static double |
RAD_TO_DEG |
Constructor and Description |
---|
GeoUtils() |
Modifier and Type | Method and Description |
---|---|
static java.util.ArrayList<com.mapbox.mapboxsdk.geometry.LatLng> |
close_poly(java.util.ArrayList<com.mapbox.mapboxsdk.geometry.LatLng> polygon)
Simply create a new
ArrayList that closes the provided one by inserting a clone of its
first member at the end. |
static com.mapbox.mapboxsdk.geometry.LatLng |
compute_centroid(java.util.ArrayList<com.mapbox.mapboxsdk.geometry.LatLng> locations)
Computes the centroid of the given locations array.
|
static double |
earth_radius(double latitude)
Returns the distance from the Earth's center to a point on its spheroid surface at the given latitude.
|
static boolean |
in_polygon(com.mapbox.mapboxsdk.geometry.LatLng location,
java.util.ArrayList<com.mapbox.mapboxsdk.geometry.LatLng> polygon)
Tests if a given location is within a polygon.
|
static com.mapbox.mapboxsdk.geometry.LatLng |
interpolate_list(com.mapbox.mapboxsdk.geometry.LatLng[] locations_list,
float progress) |
static com.mapbox.mapboxsdk.geometry.LatLng |
interpolate(com.mapbox.mapboxsdk.geometry.LatLng start,
com.mapbox.mapboxsdk.geometry.LatLng end,
float progress)
Computes the linear interpolation between 2
LatLng , by a specified extent. |
private static Vector2 |
latlng_to_vector2(com.mapbox.mapboxsdk.geometry.LatLng location)
Converts a
LatLng to its Vector2 representation. |
static com.mapbox.mapboxsdk.geometry.LatLng |
location_at_screen_center() |
static float |
min_distance(com.mapbox.mapboxsdk.geometry.LatLng reference,
java.util.ArrayList<com.mapbox.mapboxsdk.geometry.LatLng> locations)
Returns the minimum distance between a reference point and a list of other locations.
|
static com.mapbox.mapboxsdk.geometry.LatLng |
project_on_circle(com.mapbox.mapboxsdk.geometry.LatLng location,
double radius,
double angle)
Projects a given location to a certain radius along a provided angle.
|
private static final double RAD_TO_DEG
private static final double DEG_TO_RAD
public static com.mapbox.mapboxsdk.geometry.LatLng compute_centroid(java.util.ArrayList<com.mapbox.mapboxsdk.geometry.LatLng> locations)
locations
- An ArrayList describing the polygon on which to find the centroidpublic static java.util.ArrayList<com.mapbox.mapboxsdk.geometry.LatLng> close_poly(java.util.ArrayList<com.mapbox.mapboxsdk.geometry.LatLng> polygon)
ArrayList
that closes the provided one by inserting a clone of its
first member at the end.polygon
- The ArrayList
of points to close.public static com.mapbox.mapboxsdk.geometry.LatLng project_on_circle(com.mapbox.mapboxsdk.geometry.LatLng location, double radius, double angle)
location
- The LatLng point to projectradius
- The amount of projection (expressed as degrees equivalent distance of meters)angle
- The angle_to of projection@Nullable public static com.mapbox.mapboxsdk.geometry.LatLng interpolate_list(com.mapbox.mapboxsdk.geometry.LatLng[] locations_list, float progress)
public static com.mapbox.mapboxsdk.geometry.LatLng interpolate(com.mapbox.mapboxsdk.geometry.LatLng start, com.mapbox.mapboxsdk.geometry.LatLng end, float progress)
LatLng
, by a specified extent.start
- The first location to anchor the interpolationend
- The second location used as the projection axisprogress
- The factor of interpolation between the 2 locationsLatLng
for the interpolated projection.private static Vector2 latlng_to_vector2(@NonNull com.mapbox.mapboxsdk.geometry.LatLng location)
LatLng
to its Vector2
representation.location
- LatLng
instance to convertVector2
point.public static float min_distance(com.mapbox.mapboxsdk.geometry.LatLng reference, java.util.ArrayList<com.mapbox.mapboxsdk.geometry.LatLng> locations)
reference
- The reference point to measure the distance fromlocations
- A list of coordinatespublic static double earth_radius(double latitude)
latitude
- The latitude where to calculate the Earth's radius frompublic static boolean in_polygon(com.mapbox.mapboxsdk.geometry.LatLng location, java.util.ArrayList<com.mapbox.mapboxsdk.geometry.LatLng> polygon)
location
- The LatLng
to testpolygon
- An array of LatLng
describing the contour of the polygonpublic static com.mapbox.mapboxsdk.geometry.LatLng location_at_screen_center()