GeoJSONMultiPoint.fromMap constructor
Constructs a GeoJSONMultiPoint from a Map.
Implementation
factory GeoJSONMultiPoint.fromMap(Map<String, dynamic> map) {
assert(map.containsKey('type'), 'There MUST be contains key `type`');
assert(['MultiPoint'].contains(map['type']), 'Invalid type');
assert(map.containsKey('coordinates'),
'There MUST be contains key `coordinates`');
assert(map['coordinates'] is List, 'There MUST be array of positions.');
final lll = map['coordinates'];
final coords = <List<double>>[];
lll.forEach((ll) {
assert(ll is List, 'There MUST be List');
assert((ll as List).length > 1, 'There MUST be two or more element');
final pos = ll.map((e) => e.toDouble()).cast<double>().toList();
coords.add(pos);
});
return GeoJSONMultiPoint(coords);
}