PolygonUtil class

Port of PolyUtil from android-maps-utils (https://github.com/googlemaps/android-maps-utils)

Constructors

PolygonUtil()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

containsLocation(LatLng point, List<LatLng> polygon, bool geodesic) bool
containsLocationAtLatLng(num latitude, num longitude, List<LatLng> polygon, bool geodesic) bool
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.
decode(String encodedPath) List<LatLng>
distanceToLine(LatLng p, LatLng start, LatLng end) num
Computes the distance on the sphere between the point p and the line segment start to end.
encode(List<LatLng> path) String
Encodes a sequence of LatLngs into an encoded path string.
isClosedPolygon(List<LatLng> poly) bool
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
isLocationOnEdge(LatLng point, List<LatLng> polygon, bool geodesic, {num tolerance = defaultTolerance}) bool
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.
isLocationOnPath(LatLng point, List<LatLng> polyline, bool geodesic, {num tolerance = defaultTolerance}) bool
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.
locationIndexOnEdgeOrPath(LatLng point, List<LatLng> poly, bool closed, bool geodesic, num toleranceEarth) int
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.
locationIndexOnPath(LatLng point, List<LatLng> poly, bool geodesic, {num tolerance = defaultTolerance}) int
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.
simplify(List<LatLng> poly, num tolerance) List<LatLng>
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. When the providing a polygon as input, the first and last point of the list MUST have the same latitude and longitude (i.e., the polygon must be closed). If the input polygon is not closed, the resulting polygon may not be fully simplified. The time complexity of Douglas-Peucker is O(n^2), so take care that you do not call this algorithm too frequently in your code.

Constants

defaultTolerance → const num
earthRadius → const num