public static Geometry polygonToLineString(Geometry geom) throws GeometryException {
    List<LineString> lineStrings = new ArrayList<>();
    getLineStrings(geom, lineStrings);
    if (lineStrings.isEmpty()) {
      throw new GeometryException("polygon_to_linestring_empty", "No line strings");
    } else if (lineStrings.size() == 1) {
      return lineStrings.getFirst();
    } else {
      return createMultiLineString(lineStrings);
    }
  }
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