GeoJsonFeatureCollection.fromJson constructor

GeoJsonFeatureCollection.fromJson(
  1. Map<String, dynamic> json
)

Generate a GeoJsonFeatureCollection from a received Map having keys 'bbox' and 'features'.

Implementation

factory GeoJsonFeatureCollection.fromJson(Map<String, dynamic> json) =>
    GeoJsonFeatureCollection(
      bbox: <Coordinate>[
        Coordinate(longitude: json['bbox'][0], latitude: json['bbox'][1]),
        Coordinate(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(),
    );