MultiPoint.fromJson constructor
Creates a MultiPoint from a valid GeoJSON Map.
Example:
MultiPoint.fromJson({'type': 'Feature', 'geometry': {'type': 'MultiPoint', 'coordinates': [[1, 2], [3, 4]]}, 'properties': {}}); // MultiPoint([Coordinate(1, 2), Coordinate(3, 4)])
Implementation
@override
factory MultiPoint.fromJson(Map<String, dynamic> json) {
if (json['geometry']['type'] != 'MultiPoint') {
throw ArgumentError('json is not a MultiPoint');
}
return MultiPoint(
json['geometry']['coordinates']
.map((c) => Coordinate(c[1], c[0]))
.toList(),
properties: Map<String, dynamic>.from(json['properties']),
);
}