Poly Util
A utility class containing geometric calculations for polygons and polylines. This class provides methods for determining if a point is inside a polygon, on the edge of a polygon, simplifying polylines, and encoding/decoding polylines.
The methods in this class are designed to be used with the Google Maps Android API, and they operate on {@link LatLng} objects. The calculations can be performed using either geodesic (great circle) or rhumb (loxodromic) paths.
Functions
Computes whether the given point lies inside the specified polygon. The polygon is always considered closed, regardless of whether the last point equals the first or not. Inside is defined as not containing the South Pole -- the South Pole is always outside. The polygon is formed of great circle segments if geodesic is true, and of rhumb (loxodromic) segments otherwise.
Overload of {@link #containsLocation(LatLng, List, boolean)} that takes latitude and longitude as separate arguments.
Computes the distance on the sphere between the point p and the line segment start to end.
Returns true if the provided list of points is a closed polygon (i.e., the first and last points are the same), and false if it is not
Computes whether the given point lies on or near the edge of a polygon, within a specified tolerance in meters. The polygon edge is composed of great circle segments if geodesic is true, and of Rhumb segments otherwise. The polygon edge is implicitly closed -- the closing segment between the first point and the last point is included.
Computes whether the given point lies on or near a polyline, within a specified tolerance in meters. The polyline is composed of great circle segments if geodesic is true, and of Rhumb segments otherwise. The polyline is not closed -- the closing segment between the first point and the last point is not included.
Computes whether (and where) a given point lies on or near a polyline, within a specified tolerance. If closed, the closing segment between the last and first points of the polyline is not considered.
Computes whether (and where) a given point lies on or near a polyline, within a specified tolerance. The polyline is not closed -- the closing segment between the first point and the last point is not included.
Simplifies the given poly (polyline or polygon) using the Douglas-Peucker decimation algorithm. Increasing the tolerance will result in fewer points in the simplified polyline or polygon.