public class GeoUtils
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
GeoUtils.ConvexHullAlgorithm |
| Modifier and Type | Field and Description |
|---|---|
static org.locationtech.jts.geom.GeometryFactory |
DEFAULT_GEOMETRY_FACTORY
Offer a default geometry factory for the WGS84 coordinate system
|
static tech.units.indriya.ComparableQuantity<javax.measure.quantity.Length> |
EARTH_RADIUS |
| Modifier | Constructor and Description |
|---|---|
protected |
GeoUtils() |
| Modifier and Type | Method and Description |
|---|---|
static net.morbz.osmonaut.osm.Relation |
buildClosedWays(net.morbz.osmonaut.osm.Relation relation)
Deprecated.
This method is currently not under test and has to be revised thoroughly
|
static net.morbz.osmonaut.geometry.Polygon |
buildConvexHull(java.util.Set<java.awt.Point> points,
int precision,
GeoUtils.ConvexHullAlgorithm algorithm)
Deprecated.
ATTENTION! DON'T REMOVE: This method is currently not under test and has to be
revised thoroughly
|
static org.locationtech.jts.geom.LineString |
buildSafeLineString(org.locationtech.jts.geom.LineString lineString)
Convert a given
LineString with at least two points into a 'safe to be compared' LineString This is done by removing duplicates in the points in the provided linestring as
well as a small change of the start coordinate if the linestring only consists of two
coordinates. |
static org.locationtech.jts.geom.LineString |
buildSafeLineStringBetweenCoords(org.locationtech.jts.geom.Coordinate c1,
org.locationtech.jts.geom.Coordinate c2)
Build an instance of
LineString between two coordinates that is safe to be compared
even if the provided two coordinates are exactly the same coordinates. |
static org.locationtech.jts.geom.LineString |
buildSafeLineStringBetweenPoints(org.locationtech.jts.geom.Point p1,
org.locationtech.jts.geom.Point p2)
Build an instance of
LineString between two points that is safe to be compared even if
the provided two points consist of exactly the same coordinates. |
static javax.measure.Quantity<javax.measure.quantity.Area> |
calcArea(net.morbz.osmonaut.geometry.Polygon p)
Deprecated.
ATTENTION! DON'T REMOVE: This method is currently not under test and has to be
revised thoroughly
|
static javax.measure.Quantity<javax.measure.quantity.Area> |
calcArea(net.morbz.osmonaut.osm.Way w)
Deprecated.
ATTENTION! DON'T REMOVE: This method is currently not under test and has to be
revised thoroughly
|
static javax.measure.Quantity<javax.measure.quantity.Area> |
calcGeo2qmNew(double geoArea,
javax.measure.Quantity<javax.measure.quantity.Area> cor)
Deprecated.
ATTENTION! DON'T REMOVE: This method is currently not under test and has to be
revised thoroughly
|
static tech.units.indriya.ComparableQuantity<javax.measure.quantity.Length> |
calcHaversine(double lat1,
double lng1,
double lat2,
double lng2)
Calculates the distance in km between two lat/long points using the haversine formula
|
static double |
calculateBuildingArea(net.morbz.osmonaut.osm.Way building)
Deprecated.
ATTENTION! DON'T REMOVE: This method is currently not under test and has to be
revised thoroughly
|
static java.util.SortedSet<CoordinateDistance> |
getCoordinateDistances(org.locationtech.jts.geom.Point baseCoordinate,
java.util.Collection<org.locationtech.jts.geom.Point> coordinates)
Calculates and sorts the distances between a base coordinate and other given coordinates using
calcHaversine(double, double, double, double) |
static net.morbz.osmonaut.geometry.Polygon |
getIntersection(net.morbz.osmonaut.geometry.Polygon a,
net.morbz.osmonaut.geometry.Polygon b)
Deprecated.
ATTENTION! DON'T REMOVE: This method is currently not under test and has to be
revised thoroughly
|
static boolean |
isBetween(net.morbz.osmonaut.osm.Node a,
net.morbz.osmonaut.osm.Node b,
net.morbz.osmonaut.osm.Node c)
Deprecated.
ATTENTION! DON'T REMOVE: This method is currently not under test and has to be
revised thoroughly
|
static boolean |
isInsideLanduse(net.morbz.osmonaut.osm.LatLon node,
java.util.List<net.morbz.osmonaut.osm.Way> landUses)
Deprecated.
ATTENTION! DON'T REMOVE: This method is currently not under test and has to be
revised thoroughly
|
static org.locationtech.jts.geom.Point |
latlonToPoint(net.morbz.osmonaut.osm.LatLon latLon)
Calculates the geo position as a Point from a given Latlon (net.morbz.osmonaut.osm).
|
static java.util.List<net.morbz.osmonaut.osm.LatLon> |
radiusWithCircle(net.morbz.osmonaut.osm.LatLon center,
javax.measure.Quantity<javax.measure.quantity.Length> radius)
Deprecated.
ATTENTION! DON'T REMOVE: This method is currently not under test and has to be
revised thoroughly
|
static net.morbz.osmonaut.geometry.Polygon |
radiusWithCircleAsPolygon(net.morbz.osmonaut.osm.LatLon center,
javax.measure.Quantity<javax.measure.quantity.Length> radius)
Draws a circle with a radius of the provided distance around the provided center coordinates
and returns the result as a drawable polygon (one point per degree)
|
static boolean |
rayCasting(net.morbz.osmonaut.geometry.Polygon shape,
net.morbz.osmonaut.osm.LatLon node)
Deprecated.
ATTENTION! DON'T REMOVE: This method is currently not under test and has to be
revised thoroughly
|
static tech.units.indriya.ComparableQuantity<javax.measure.quantity.Length> |
totalLengthOfLineString(org.locationtech.jts.geom.LineString lineString)
Calculates the total length of a LineString through building the sum of the distances between
all points of LineString using
calcHaversine(double, double, double, double) |
static net.morbz.osmonaut.osm.Way |
wayFromWays(java.util.List<net.morbz.osmonaut.osm.Way> waysToChain,
javax.measure.Quantity<javax.measure.quantity.Length> radius,
int wayId)
Deprecated.
ATTENTION! DON'T REMOVE: This method is currently not under test and has to be
revised thoroughly
|
static org.locationtech.jts.geom.Point |
xyToPoint(double x,
double y)
Wraps XY values in a JTS geometry point
|
public static final tech.units.indriya.ComparableQuantity<javax.measure.quantity.Length> EARTH_RADIUS
public static final org.locationtech.jts.geom.GeometryFactory DEFAULT_GEOMETRY_FACTORY
public static tech.units.indriya.ComparableQuantity<javax.measure.quantity.Length> calcHaversine(double lat1,
double lng1,
double lat2,
double lng2)
lat1 - Latitude value of the first coordinatelng1 - Longitude value of the first coordinatelat2 - Latitude value of the second coordinatelng2 - Longitude value of the second coordinatePowerSystemUnits.KILOMETREpublic static tech.units.indriya.ComparableQuantity<javax.measure.quantity.Length> totalLengthOfLineString(org.locationtech.jts.geom.LineString lineString)
calcHaversine(double, double, double, double)lineString - the line string which length shall be calculatedpublic static java.util.SortedSet<CoordinateDistance> getCoordinateDistances(org.locationtech.jts.geom.Point baseCoordinate, java.util.Collection<org.locationtech.jts.geom.Point> coordinates)
calcHaversine(double, double, double, double)baseCoordinate - the base pointcoordinates - the points to calculate the distance from the base point forpublic static org.locationtech.jts.geom.LineString buildSafeLineStringBetweenPoints(org.locationtech.jts.geom.Point p1,
org.locationtech.jts.geom.Point p2)
LineString between two points that is safe to be compared even if
the provided two points consist of exactly the same coordinates. This is done by increasing the
coordinate of the provided Point p1 by a small amount to make it different from Point
p2. For details on the bug inside LineString that is addressed here, see
https://github.com/locationtech/jts/issues/531p1 - start point of the linestringp2 - end point of the linestringLineString between the provided pointspublic static org.locationtech.jts.geom.LineString buildSafeLineStringBetweenCoords(org.locationtech.jts.geom.Coordinate c1,
org.locationtech.jts.geom.Coordinate c2)
LineString between two coordinates that is safe to be compared
even if the provided two coordinates are exactly the same coordinates. This is done by
increasing the coordinate of the provided Point c1 by a small amount to make it
different from Point c2. For details on the bug inside LineString that is
addressed here, see https://github.com/locationtech/jts/issues/531c1 - start coordinate of the linestringc2 - end coordinate of the linestringpublic static org.locationtech.jts.geom.LineString buildSafeLineString(org.locationtech.jts.geom.LineString lineString)
LineString with at least two points into a 'safe to be compared' LineString This is done by removing duplicates in the points in the provided linestring as
well as a small change of the start coordinate if the linestring only consists of two
coordinates. For details on the bug inside LineString that is addressed here, see
https://github.com/locationtech/jts/issues/531lineString - the linestring that should be checked and maybe converted to a 'safe to be
compared' linestringpublic static org.locationtech.jts.geom.Point latlonToPoint(net.morbz.osmonaut.osm.LatLon latLon)
latLon - Latlon from which the geo position shall be calculatedpublic static org.locationtech.jts.geom.Point xyToPoint(double x,
double y)
x - longitude valuey - latitude value@Deprecated
public static net.morbz.osmonaut.osm.Relation buildClosedWays(net.morbz.osmonaut.osm.Relation relation)
throws GeoPreparationException
RelationMembers and joins the given ways to have closed ways.
This only works, if the ways are connected all in a line.relation - Relation relation to treatrelation with closed waysGeoPreparationException@Deprecated
public static net.morbz.osmonaut.geometry.Polygon buildConvexHull(java.util.Set<java.awt.Point> points,
int precision,
GeoUtils.ConvexHullAlgorithm algorithm)
throws GeoPreparationException
points - The Set of Points that shall be enclosed by the convex hullprecision - Prescision to use for "dirty casting"algorithm - GeoUtils.ConvexHullAlgorithm to use. CAUTION GeoUtils.ConvexHullAlgorithm.CHAN
currently not working!Polygon of the convex hullGeoPreparationException - If points got missing, no boundary can be found, too few points
are provided or anything else goes wrongjava.lang.NullPointerException - If there is null@Deprecated
public static net.morbz.osmonaut.geometry.Polygon getIntersection(net.morbz.osmonaut.geometry.Polygon a,
net.morbz.osmonaut.geometry.Polygon b)
Polygons a and b.a - First Polygonb - Second PolygonPolygon if the intersection exists and null if not@Deprecated
public static javax.measure.Quantity<javax.measure.quantity.Area> calcArea(net.morbz.osmonaut.osm.Way w)
throws GeoPreparationException
calcArea(Polygon)w - Closed way, that surrounds the areaUnits.SQUARE_METREGeoPreparationException - If some serious shit happens@Deprecated
public static javax.measure.Quantity<javax.measure.quantity.Area> calcArea(net.morbz.osmonaut.geometry.Polygon p)
throws GeoPreparationException
Polygon by adding subareas spanned between the longitude axis
and the line segments on the polygonp - Polygon whos area may be calculatedUnits.SQUARE_METREGeoPreparationException - If some serious shit happens@Deprecated
public static boolean isBetween(net.morbz.osmonaut.osm.Node a,
net.morbz.osmonaut.osm.Node b,
net.morbz.osmonaut.osm.Node c)
a - Node Ab - Node Bc - Node C@Deprecated
public static javax.measure.Quantity<javax.measure.quantity.Area> calcGeo2qmNew(double geoArea,
javax.measure.Quantity<javax.measure.quantity.Area> cor)
geoArea: - the area of the building based on geo coordinatescor: - the optional correction factor@Deprecated
public static boolean isInsideLanduse(net.morbz.osmonaut.osm.LatLon node,
java.util.List<net.morbz.osmonaut.osm.Way> landUses)
@Deprecated
public static boolean rayCasting(net.morbz.osmonaut.geometry.Polygon shape,
net.morbz.osmonaut.osm.LatLon node)
@Deprecated public static double calculateBuildingArea(net.morbz.osmonaut.osm.Way building)
building - public static net.morbz.osmonaut.geometry.Polygon radiusWithCircleAsPolygon(net.morbz.osmonaut.osm.LatLon center,
javax.measure.Quantity<javax.measure.quantity.Length> radius)
center - coordinate of the circle's centerradius - radius of the circle@Deprecated
public static java.util.List<net.morbz.osmonaut.osm.LatLon> radiusWithCircle(net.morbz.osmonaut.osm.LatLon center,
javax.measure.Quantity<javax.measure.quantity.Length> radius)
center - radius - @Deprecated
public static net.morbz.osmonaut.osm.Way wayFromWays(java.util.List<net.morbz.osmonaut.osm.Way> waysToChain,
javax.measure.Quantity<javax.measure.quantity.Length> radius,
int wayId)
waysToChain - the ways from a relationradius - the radius that should be considered for search for the next connection point
between two wayswayId - the id of the newly created wayWay built from a collection of Ways