Polygon class
A Polygon is a single closed path with shared properties. The first LinearRing defines the outer boundary of the Polygon, while the following LinearRings define holes within the Polygon.
Constructors
-
Polygon(List<
LinearRing> coordinates, {Map<String, dynamic> properties = const <String, dynamic>{}}) -
Polygon.fromJson(Map<
String, dynamic> json) -
Creates a Polygon from a GeoJSON Map.
factory
- Polygon.fromWKT(String wkt)
-
Creates a Polygon from a WKT String.
Right now, cannot handle polygons with holes.
factory
Properties
- area → double
-
The area pf the Polygon in square meters.
no setter
- bbox → BoundingBox
-
Returns the BoundingBox of the Polygon.
no setteroverride
- center → Point
-
Calculates the center Point of the Polygon.
Right now, cannot handle polygons with holes.
no setteroverride
-
coordinates
↔ List<
LinearRing> -
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
-
properties
↔ Map<
String, dynamic> -
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
contains(
Point point) → bool - Returns whether or not the Polygon contains the Point. Uses the Ray Casting algorithm.
-
explode(
) → List< Point> -
Explodes the Polygon into a List of Points.
override
-
intersects(
Polygon poly) → bool -
Returns whether the two Polygons intersect.
Uses the
toLineString
to check for intersections, rather than checking for shared volume. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
Returns a GeoJSON Map of the Polygon.
override
-
toLineString(
) → LineString - Uses the Polygon's coordinates to make a LineString. Ignores any holes in the polygon.
-
toString(
) → String -
A string representation of this object.
override
-
toWKT(
) → String -
Converts the Polygon to a WKT String.
override
Operators
-
operator +(
Feature other) → FeatureCollection -
Adds two Features together to form a FeatureCollection.
Each Feature in the FeatureCollection will retain their properties and coordinates.
inherited
-
operator ==(
Object other) → bool -
The equality operator.
inherited