Feature<T extends Geometry> class

A feature is a geospatial entity with id, properties and geometry.

Features are bounded objects with optional bounds defining a minimum bounding box for a feature.

Some implementations may also contain "foreign members", like custom data containing property objects.

Feature objects have an optional primary geometry of T.

According to the OGC Glossary a feature is "a digital representation of a real world entity. It has a spatial domain, a temporal domain, or a spatial/temporal domain as one of its attributes. Examples of features include almost anything that can be placed in time and space, including desks, buildings, cities, trees, forest stands, ecosystems, delivery vehicles, snow removal routes, oil wells, oil pipelines, oil spill, and so on".

Supports representing data from GeoJSON (https://geojson.org/) features.

Inheritance

Constructors

Feature({Object? id, T? geometry, Map<String, dynamic>? properties, Box? bounds, Map<String, dynamic>? custom})
A feature of id, geometry and properties.
const
Feature.build({Object? id, WriteGeometries? geometry, Map<String, dynamic>? properties, Box? bounds, Map<String, dynamic>? custom})
Builds a feature from id, geometry and properties.
factory

Properties

bounds Box?
An optional bounding box explicitely set (or otherwise directly available) for this object.
no setterinherited
coordType Coords
A value of Coords representing the coordinate type of position data contained directly or within child objects.
no setteroverride
custom Map<String, dynamic>?
Optional custom or "foreign member" properties as a map.
no setterinherited
geometry → T?
An optional primary geometry of T for this feature.
no setter
hashCode int
The hash code for this object.
no setteroverride
id Object?
An optional identifier (a string or number) for this feature.
no setter
isEmptyByGeometry bool
Returns true if this feature do not contain any geometry or geometry is empty.
no setteroverride
properties Map<String, dynamic>
Required properties for this feature (allowed to be empty).
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

boundsAligned2D({Aligned align = Aligned.center, PositionScheme scheme = Position.scheme}) Position?
Returns an aligned 2D position relative to a bounding box accessed by getBounds.
inherited
calculateBounds({PositionScheme scheme = Position.scheme}) Box?
Calculate a bounding box for this object.
override
copyWith({Object? id, T? geometry, Map<String, dynamic>? properties, Map<String, dynamic>? custom}) Feature<T>
Copy this feature with optional id, geometry, properties and custom properties.
equals2D(covariant FeatureObject other, {double toleranceHoriz = defaultEpsilon}) bool
True if this and other equals by testing 2D coordinate values of all position data (that must be in same order in both objects) contained directly or by child objects.
override
equals3D(covariant FeatureObject other, {double toleranceHoriz = defaultEpsilon, double toleranceVert = defaultEpsilon}) bool
True if this and other equals by testing 3D coordinate values of all position data (that must be in same order in both objects) contained directly or by child objects.
override
equalsCoords(covariant FeatureObject other) bool
True if this and other contain exactly same coordinate values (or both are empty) in the same order and with the same coordinate type.
override
getBounds({PositionScheme scheme = Position.scheme}) Box?
Returns the current bounds if it's populated and conforms to scheme, or otherwise returns one calculated by calculateBounds.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
populated({int traverse = 0, bool onBounds = true, PositionScheme scheme = Position.scheme}) Feature<Geometry>
Returns a feature object of the same subtype as this with certain data members populated.
override
project(Projection projection) Feature<T>
Returns an object of the same subtype as this with all position data projected using projection and non-positional properties left intact.
override
toBytes({required BinaryFormat<FeatureContent> format, Endian? endian, Map<String, dynamic>? options}) Uint8List
The binary representation of this feature object, with format applied.
inherited
toString() String
The string representation of this feature object as specified by GeoJSON.
inherited
toText({TextWriterFormat<FeatureContent> format = GeoJSON.feature, int? decimals, CoordRefSys? crs, Map<String, dynamic>? options}) String
The string representation of this feature object, with format applied.
inherited
unpopulated({int traverse = 0, bool onBounds = true}) Feature<Geometry>
Returns a feature object of the same subtype as this with certain data members unpopulated (or cleared).
override
writeTo(FeatureContent writer) → void
Writes this feature object to writer.
override

Operators

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

Static Methods

fromData<T extends Geometry>(Map<String, dynamic> data, {TextReaderFormat<FeatureContent> format = GeoJSON.feature, CoordRefSys? crs, Map<String, dynamic>? options}) Feature<T>
Decodes a feature with the geometry of T from data conforming to format.
parse<T extends Geometry>(String text, {TextReaderFormat<FeatureContent> format = GeoJSON.feature, CoordRefSys? crs, Map<String, dynamic>? options}) Feature<T>
Parses a feature with the geometry of T from text conforming to format.