toJson method

  1. @override
Map<String, dynamic> toJson()
override

Converts the MultiPoint to a GeoJSON Map.

Example:

MultiPoint([Coordinate(1, 2), Coordinate(3, 4)]).toJson(); // {'type': 'Feature', 'geometry': {'type': 'MultiPoint', 'coordinates': [[1, 2], [3, 4]]}, 'properties': {}}

Implementation

@override
Map<String, dynamic> toJson() {
  return {
    'type': 'Feature',
    'geometry': {
      'type': 'MultiPoint',
      'coordinates': coordinates.map((c) => c.toJson()).toList()
    },
    'properties': properties,
  };
}