toJson method

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

Returns a GeoJSON representation of the MultiLineString.

Example:

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

Implementation

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