center property

  1. @override
Point get center
override

Returns the center Point of the LineString

Example:

LineString([Coordinate(1, 2), Coordinate(3, 4)]).center(); // Coordinate(2, 3)

Implementation

@override
Point get center {
  final lat = coordinates.map((c) => c.latitude).reduce((a, b) => a + b) /
      coordinates.length;
  final long = coordinates.map((c) => c.longitude).reduce((a, b) => a + b) /
      coordinates.length;
  return Point.fromLatLong(lat, long);
}