meta library
Iterators and reducers (coordEach, featureEach, flattenEach, etc.) for traversing GeoJSON.
Classes
- BBox
-
Please make sure, you arrange your parameters like this:
Longitude 1, Latitude 1, Altitude 1 (optional), Longitude 2, Latitude 2, Altitude 2 (optional)
You can either specify 4 or 6 parameters
If you are using the default constructor with two dimensional positions (lng + lat only), please use the constructor like this:
BBox(lng1, lat1, lng2, lat2); - CoordinateType
- Coordinate types, following https://tools.ietf.org/html/rfc7946#section-4
-
Feature<
T extends GeometryObject> - Feature, as specified here https://tools.ietf.org/html/rfc7946#section-3.2
-
FeatureCollection<
T extends GeometryObject> - FeatureCollection, as specified here https://tools.ietf.org/html/rfc7946#section-3.3
- GeoJSONObject
- GeometryCollection
- GeometryCollection, as specified here https://tools.ietf.org/html/rfc7946#section-3.1.8
- GeometryObject
-
GeometryType<
T> - LineString
- LineString, as specified here https://tools.ietf.org/html/rfc7946#section-3.1.4
- MultiLineString
- MultiLineString, as specified here https://tools.ietf.org/html/rfc7946#section-3.1.5
- MultiPoint
- MultiPoint, as specified here https://tools.ietf.org/html/rfc7946#section-3.1.3
- MultiPolygon
- MultiPolygon, as specified here https://tools.ietf.org/html/rfc7946#section-3.1.7
- Point
- Point, as specified here https://tools.ietf.org/html/rfc7946#section-3.1.2
- Polygon
- Polygon, as specified here https://tools.ietf.org/html/rfc7946#section-3.1.6
- Position
- Please make sure, you arrange your parameters like this:
Enums
Extensions
-
FeatureCollectionOtherMembersExtension
on FeatureCollection<
GeometryObject> - Extension to add "other members" support specifically to FeatureCollection
-
FeatureOtherMembersExtension
on Feature<
GeometryObject> - Extension to add "other members" support specifically to Feature
- GeoJSONObjectOtherMembersExtension on GeoJSONObject
- Extension to add "other members" support to GeoJSONObject This follows RFC 7946 specification: "A GeoJSON object MAY have 'other members'. Implementations MUST NOT interpret foreign members as having any meaning unless part of an extension or profile."
- GeometryObjectOtherMembersExtension on GeometryObject
- Extension to add "other members" support specifically to GeometryObject
Functions
-
applyFilter(
Map? properties, dynamic filter) → bool -
applyFilter
Takes a Map
propertiesand afilter, Returns a bool indicating filter is applied to the properties. -
clusterEach(
FeatureCollection< GeometryObject> geojson, dynamic property, ClusterEachCallback callback) → void -
clusterEach
Takes a FeatureCollection, a dynamic
propertykey/value used to create clusters, and a ClusterEachCallback method that takes (cluster, clusterValue, currentIndex) and Returns void. For example: -
clusterReduce<
T> (FeatureCollection< GeometryObject> geojson, dynamic property, ClusterReduceCallback<T> callback, dynamic initialValue) → T? -
Reduces clusters in Features, similar to Iterable.reduce
Takes a FeatureCollection
geojson, a dynamicproperty, a GeoJSONObject's property key/value used to create clusters, a ClusterReduceCallback method, and aninitialValueto use as the first argument to the first call of the callback. Returns the value that results from the reduction. For example: -
coordAll(
GeoJSONObject geojson) → List< Position?> - Gets all coordinates from any GeoJSONObject. Receives any GeoJSONObject Returns List<Position> For example:
-
coordEach(
GeoJSONObject geoJSON, Function callback, [bool excludeWrapCoord = false]) → void -
Iterates over coordinates in any
geoJSONObject, similar to Iterable.forEach example: -
coordReduce<
T> (GeoJSONObject geojson, CoordReduceCallback< T> callback, T? initialValue, [bool excludeWrapCoord = false]) → T? - Reduces coordinates in any GeoJSONObject, similar to Iterable.reduce
-
createBins(
FeatureCollection< GeometryObject> geojson, dynamic property) → Map<dynamic, List< int> > -
createBins
Takes a FeatureCollection geojson, and dynamic
propertykey whose corresponding values of the Features will be used to create bins. Returns Map<String, List -
extractOtherMembers(
Map< String, dynamic> json, List<String> standardKeys) → Map<String, dynamic> - Utility to extract "other members" from GeoJSON objects according to RFC 7946 specification.
-
featureEach(
GeoJSONObject geoJSON, FeatureEachCallback callback) → void -
Iterates over features in any
geoJSONObject, callingcallbackon each iteration. Similar to Iterable.forEach. For example: -
featureReduce<
T> (GeoJSONObject geojson, FeatureReduceCallback< T> callback, T? initialValue) → T? - Reduces features in any GeoJSONObject, similar to Iterable.reduce.
-
filterProperties(
Map< String, dynamic> properties, List<String> ? keys) → Map<String, dynamic> -
filterProperties
Takes Map<String, dynamic>
properties, and List<String>keysused to filter Properties. Returns Map<String, dynamic> filtered Properties For example: -
flattenEach(
GeoJSONObject geoJSON, FlattenEachCallback callback) → void -
Iterates over flattened features in any
geoJSONObject, similar to Iterable.forEach, callingcallbackon each flattened feature -
flattenReduce<
T> (GeoJSONObject geojson, FlattenReduceCallback< T> callback, T? initialValue) → T? -
Reduces flattened features in any GeoJSONObject, similar to Iterable.reduce.
Takes a FeatureCollection, Feature, or GeometryType
a FlattenReduceCallback method that takes (previousValue, currentFeature, featureIndex, multiFeatureIndex),
an
initialValueValue to use as the first argument to the first call of the callback. Returns the value that results from the reduction. For example: -
geomEach(
GeoJSONObject geoJSON, GeomEachCallback callback) → void -
Iterates over each geometry in
geoJSON, callingcallbackon each iteration. Similar to Iterable.forEach -
geomReduce<
T> (GeoJSONObject geoJSON, GeomReduceCallback< T> callback, T? initialValue) → T? - Reduces geometry in any GeoJSONObject, similar to Iterable.reduce.
-
getCluster(
FeatureCollection< GeometryObject> geojson, dynamic filter) → FeatureCollection<GeometryObject> -
Get Cluster
Takes a FeatureCollection<Feature> and a
dynamicfilterused on GeoJSON properties to get Cluster. Returns a FeatureCollection single cluster filtered by GeoJSON Properties For example: -
propEach(
GeoJSONObject geoJSON, PropEachCallback callback) → void -
Iterates over properties in any
geoJSONobject, callingcallbackon each iteration. Similar to Iterable.forEach -
propertiesContainsFilter(
Map properties, Map filter) → bool -
Properties contains filter (does not apply deepEqual operations)
Takes a Map
propertiesvalue, and a Map filter and Returns bool if filter does equal thepropertiesFor example -
propReduce<
T> (GeoJSONObject geojson, PropReduceCallback< T> callback, T? initialValue) → T? - Reduces properties in any GeoJSONObject into a single value, similar to how Iterable.reduce works. However, in this case we lazily run the reduction, so List of all properties is unnecessary.
-
segmentEach(
GeoJSONObject geojson, SegmentEachCallback callback, {bool combineNestedGeometries = true}) → void - Iterates over 2-vertex line segment in any GeoJSON object, similar to Iterable.forEach (Multi)Point geometries do not contain segments therefore they are ignored during this operation.
-
segmentReduce<
T> (GeoJSONObject geojson, SegmentReduceCallback< T> callback, T? initialValue, {bool combineNestedGeometries = true}) → T? - Reduces 2-vertex line segment in any GeoJSON object, similar to Iterable.reduce (Multi)Point geometries do not contain segments therefore they are ignored during this operation.
Typedefs
-
ClusterEachCallback
= dynamic Function(FeatureCollection<
GeometryObject> ? cluster, dynamic clusterValue, int? currentIndex) -
ClusterEachCallback
Takes a FeatureCollection, the cluster being processed, a
clusterValueused to create cluster being processed, and thecurrentIndex, the index of current element being processed in the List. Starts at index 0 Returns void. -
ClusterReduceCallback<
T> = T? Function(T? previousValue, FeatureCollection< GeometryObject> ? cluster, dynamic clusterValue, int? currentIndex) -
ClusterReduceCallback
The first time the callback function is called, the values provided as arguments depend
on whether the reduce method has an
initialValueargument. - CoordEachCallback = dynamic Function(Position? currentCoord, int? coordIndex, int? featureIndex, int? multiFeatureIndex, int? geometryIndex)
-
CoordReduceCallback<
T> = T? Function(T? previousValue, Position? currentCoord, int? coordIndex, int? featureIndex, int? multiFeatureIndex, int? geometryIndex) - Callback for coordReduce
-
FeatureEachCallback
= dynamic Function(Feature<
GeometryObject> currentFeature, int featureIndex) - Callback for featureEach
-
FeatureReduceCallback<
T> = T? Function(T? previousValue, Feature< GeometryObject> currentFeature, int featureIndex) - Callback for featureReduce
-
FlattenEachCallback
= dynamic Function(Feature<
GeometryType> currentFeature, int featureIndex, int multiFeatureIndex) - Callback for flattenEach
-
FlattenReduceCallback<
T> = T? Function(T? previousValue, Feature< GeometryObject> currentFeature, int featureIndex, int multiFeatureIndex) -
Callback for flattenReduce
The first time the callback function is called, the values provided as
arguments depend on whether the reduce method has an
initialValueargument. If aninitialValueis provided to the reduce method: -
GeomEachCallback
= dynamic Function(GeometryType? currentGeometry, int? featureIndex, Map<
String, dynamic> ? featureProperties, BBox? featureBBox, dynamic featureId) -
GeomReduceCallback<
T> = T? Function(T? previousValue, GeometryType? currentGeometry, int? featureIndex, Map< String, dynamic> ? featureProperties, BBox? featureBBox, dynamic featureId) - Callback for geomReduce
- LocalizedCoordEachCallback = dynamic Function(Position? currentCoord, int? coordIndex, int? featureIndex, int? multiFeatureIndex, int? geometryIndex, int? localCoordIndex)
-
PropEachCallback
= dynamic Function(Map<
String, dynamic> ? currentProperties, int featureIndex) - Callback for propEach
-
PropReduceCallback<
T> = T? Function(T? previousValue, Map< String, dynamic> ? currentProperties, int featureIndex) - Callback for propReduce
-
SegmentEachCallback
= dynamic Function(Feature<
LineString> currentSegment, int featureIndex, int? multiFeatureIndex, int? geometryIndex, int segmentIndex) - SegmentEachCallback
-
SegmentReduceCallback<
T> = T? Function(T? previousValue, Feature< LineString> currentSegment, T? initialValue, int featureIndex, int? multiFeatureIndex, int? geometryIndex, int segmentIndex) - Callback for segmentReduce