|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.fhpotsdam.unfolding.utils.GeoUtils
public class GeoUtils
Basic geo-spatial utility methods.
Field Summary | |
---|---|
static double |
EARTH_RADIUS_KM
|
static double |
MAX_LAT
|
static double |
MAX_LON
|
static double |
MIN_LAT
|
static double |
MIN_LON
|
Constructor Summary | |
---|---|
GeoUtils()
|
Method Summary | |
---|---|
static java.util.List<Location> |
decodeOSRMPolyline(java.lang.String encoded)
|
static java.util.List<Location> |
decodePolyline(java.lang.String encoded)
|
static java.util.List<Location> |
decodePolyline(java.lang.String encoded,
int precision)
Decodes an encoded polyline string to a list of locations. |
static double |
getAngleBetween(Location location1,
Location location2)
Gets the angle between two locations. |
static float |
getArea(Feature feature)
Calculates the area of a shape feature. |
static float |
getArea(java.util.List<Location> vertices)
Calculates the area of a polygon. |
static float |
getArea(Marker marker)
Calculates the area of a shape marker. |
static Location[] |
getBoundingBox(java.util.List<Location> locations)
Returns the bounding box for the list of locations. |
static Location |
getCentroid(Feature feature)
Convenience method for getCentroid(Feature, boolean) . |
static Location |
getCentroid(Feature feature,
boolean useLargestForMulti)
Returns the centroid of a feature. |
static Location |
getCentroid(java.util.List<Location> originalVertices)
Returns the geometric center of the locations of a polygon. |
static Location |
getCentroid(Marker marker)
Gets the geometric center of the marker. |
static Location |
getCentroidFromFeatures(java.util.List<Feature> features)
Gets the overall geometric center of all features. |
static java.util.List<Location> |
getClosedPolygon(java.util.List<Location> originalVertices)
Returns a closed polygon with the last vertex the same as the first. |
static Location |
getDecimal(java.lang.Integer latDegrees,
java.lang.Integer latMinutes,
java.lang.Integer latSeconds,
java.lang.String latDirection,
java.lang.Integer lonDegrees,
java.lang.Integer lonMinutes,
java.lang.Integer lonSeconds,
java.lang.String lonDirection)
Super simplistic method to convert a geo-position as a Location. |
static Location |
getDestinationLocation(Location location,
float bearing,
float distance)
Gets the location specified by a start location, a bearing, and a distance. |
static double |
getDistance(double lat1,
double lon1,
double lat2,
double lon2)
Get distance in kilometers between two points on the earth. |
static double |
getDistance(Location location1,
Location location2)
Get distance in kilometers between two points on the earth. |
static Location |
getEuclideanCentroid(java.util.List<Location> locations)
Returns the center of the locations. |
static Feature |
getLargestFeature(MultiFeature multiFeature)
Returns the largest feature of a MultiFeature by area size. |
static Marker |
getLargestMarker(MultiMarker multiMarker)
Returns the largest marker of a MultiMarker by area size. |
static java.util.List<Location> |
getLocations(Feature feature)
Returns all locations of a feature. |
static java.util.List<Location> |
getLocations(Marker marker)
Returns all locations of a marker. |
static java.util.List<Location> |
getLocationsFromFeatures(java.util.List<Feature> features)
Returns all locations of all features. |
static java.util.List<Location> |
getLocationsFromMarkers(java.util.List<Marker> markers)
Returns all locations of all markers. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final double EARTH_RADIUS_KM
public static final double MIN_LAT
public static final double MAX_LAT
public static final double MIN_LON
public static final double MAX_LON
Constructor Detail |
---|
public GeoUtils()
Method Detail |
---|
public static double getDistance(double lat1, double lon1, double lat2, double lon2)
lat1
- Latitude of first point, in decimal degrees.lon1
- Longitude of first point, in decimal degrees.lat2
- Latitude of second point, in decimal degrees.lon2
- Longitude of second point, in decimal degrees.
public static double getDistance(Location location1, Location location2)
location1
- Location of first pointlocation2
- Location of second point
public static Location getDestinationLocation(Location location, float bearing, float distance)
location
- The start location.bearing
- The bearing in degrees.distance
- The distance in kilometers.
public static double getAngleBetween(Location location1, Location location2)
location1
- First location.location2
- Second location.
public static Location getDecimal(java.lang.Integer latDegrees, java.lang.Integer latMinutes, java.lang.Integer latSeconds, java.lang.String latDirection, java.lang.Integer lonDegrees, java.lang.Integer lonMinutes, java.lang.Integer lonSeconds, java.lang.String lonDirection)
public static Location getEuclideanCentroid(java.util.List<Location> locations)
public static Location getCentroid(java.util.List<Location> originalVertices)
getEuclideanCentroid(List)
for an alternative.)
public static java.util.List<Location> getClosedPolygon(java.util.List<Location> originalVertices)
originalVertices
- List of locations of original polygon.
public static float getArea(java.util.List<Location> vertices)
vertices
- The vertices of the polygon.
public static float getArea(Feature feature)
feature
- The feature containing location vertices.
public static float getArea(Marker marker)
marker
- The marker containing location vertices.
public static Location getCentroid(Feature feature, boolean useLargestForMulti)
feature
- The feature to get the centroid for.useLargestForMulti
- Set to true if you want to use only the largest feature for MultiFeature
s.
public static Feature getLargestFeature(MultiFeature multiFeature)
multiFeature
- The MultiFeature consisting of multiple features.
public static Marker getLargestMarker(MultiMarker multiMarker)
multiMarker
- The MultiMarker consisting of multiple markers.
public static Location getCentroid(Feature feature)
getCentroid(Feature, boolean)
.
public static Location getCentroid(Marker marker)
marker
- The marker to check.
public static Location getCentroidFromFeatures(java.util.List<Feature> features)
features
- A list of features.
public static java.util.List<Location> getLocationsFromFeatures(java.util.List<Feature> features)
features
- A list of features.
public static java.util.List<Location> getLocations(Feature feature)
feature
- The feature to get locations from.
public static java.util.List<Location> getLocationsFromMarkers(java.util.List<Marker> markers)
markers
- A list of markers.
public static java.util.List<Location> getLocations(Marker marker)
marker
- The marker to get locations from.
public static Location[] getBoundingBox(java.util.List<Location> locations)
locations
- List of locations to get the bounding box for.
public static java.util.List<Location> decodePolyline(java.lang.String encoded)
public static java.util.List<Location> decodeOSRMPolyline(java.lang.String encoded)
public static java.util.List<Location> decodePolyline(java.lang.String encoded, int precision)
encoded
- The encoded String.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |