parseInnerPoints static method

List<List<LatLng>> parseInnerPoints(
  1. List coordinates,
  2. String type
)

Implementation

static List<List<LatLng>> parseInnerPoints(List<dynamic> coordinates, String type) {
  List<List<LatLng>> points = [];
  try {
    if (type == 'Polygon') {
      // Polygon type doesn't usually have inner points
    } else if (type == 'MultiPolygon') {
      // Skip the first one as it's the outer boundary
      for (int i = 1; i < coordinates.length; i++) {
        List<dynamic> innerCoordinates = coordinates[i];
        List<LatLng> innerPoints = [];
        for (var point in innerCoordinates) {
          double lat = point[1] as double;
          double lng = point[0] as double;
          innerPoints.add(LatLng(lat, lng));
        }
        points.add(innerPoints);
      }
    }
  } catch (e, s) {
    _debugGeoJsonUtilsPrint("❌ error parseInnerPoints: $e");
    _debugGeoJsonUtilsPrint("❌ trace: $s");
  }

  return points;
}