featureCount method
Count number of features on a collection parsed from a data
object.
An optional range
specificies start offset and optional limit count
specifying a feature range to be counted on a collection.
Throws FormatException if parsing fails.
Implementation
@override
int featureCount(dynamic data, {Range? range}) {
final json = _ensureDecodedMap(data);
final List<dynamic> list;
if (json['type'] == 'Feature') {
list = <dynamic>[json];
} else {
if (json['type'] != 'FeatureCollection') {
throw const FormatException('Not valid GeoJSON FeatureCollection.');
}
list = json['features'] as List;
}
return _listByRange(list).length;
}