private static void getLineStrings(Geometry input, List<LineString> output) throws GeometryException {
    switch (input) {
      case LinearRing linearRing -> output.add(JTS_FACTORY.createLineString(linearRing.getCoordinateSequence()));
      case LineString lineString -> output.add(lineString);
      case Polygon polygon -> {
        getLineStrings(polygon.getExteriorRing(), output);
        for (int i = 0; i < polygon.getNumInteriorRing(); i++) {
          getLineStrings(polygon.getInteriorRingN(i), output);
        }
      }
      case GeometryCollection gc -> {
        for (int i = 0; i < gc.getNumGeometries(); i++) {
          getLineStrings(gc.getGeometryN(i), output);
        }
      }
      case null, default -> throw new GeometryException("get_line_strings_bad_type",
        "unrecognized geometry type: " + (input == null ? "null" : input.getGeometryType()));
    }
  }
Returns line strings for every inner and outer ring contained in a polygon.

@throws GeometryException if {@code geom} contains anything other than polygons or line strings
planetiler-core/src/main/java/com/onthegomap/planetiler/geo/GeoUtils.java