GeoJsonFeatureCollection.fromJson constructor
Generate a GeoJsonFeatureCollection from a received Map having keys 'bbox' and 'features'.
Implementation
factory GeoJsonFeatureCollection.fromJson(Map<String, dynamic> json) =>
GeoJsonFeatureCollection(
bbox: ((json['bbox'] ?? <dynamic>[]) as List<dynamic>).length < 4
? <ORSCoordinate>[]
: <ORSCoordinate>[
ORSCoordinate(
longitude: json['bbox'][0],
latitude: json['bbox'][1],
),
ORSCoordinate(
longitude: json['bbox'][2],
latitude: json['bbox'][3],
),
],
features: (json['features'] as List<dynamic>)
.map<GeoJsonFeature>(
(dynamic e) => GeoJsonFeature.fromJson(e as Map<String, dynamic>),
)
.toList(),
);