docs: public static Geometry clipToTile(TDWay way, Geometry geometry, TileCoordinate tileCoordinate,
                                        int enlargementInMeters) {
          Geometry tileBBJTS = null;
          Geometry ret = null;
  
          // create tile bounding box
          tileBBJTS = tileToJTSGeometry(tileCoordinate.getX(), tileCoordinate.getY(), tileCoordinate.getZoomlevel(),
                  enlargementInMeters);
  
          // clip the geometry by intersection with the bounding box of the tile
          // may throw a TopologyException
          try {
              if (!geometry.isValid()) {
                  // this should stop the problem of non-noded intersections that trigger an error when
                  // clipping
                  LOGGER.warning("invalid geometry prior to tile clipping, trying to repair " + way.getId());
                  geometry = JTSUtils.repairInvalidPolygon(geometry);
                  if (!geometry.isValid()) {
                      LOGGER.warning("invalid geometry even after attempt to fix " + way.getId());
                  }
              }
              ret = tileBBJTS.intersection(geometry);
              // according to Ludwig (see issue332) valid polygons may become invalid by clipping (at least
              // in the Python shapely library
              // we need to investigate this more closely and write approriate test cases
              // for now, I check whether the resulting polygon is valid and if not try to repair it
              if ((ret instanceof Polygon || ret instanceof MultiPolygon) && !ret.isValid()) {
                  LOGGER.warning("clipped way is not valid, trying to repair it: " + way.getId());
                  ret = JTSUtils.repairInvalidPolygon(ret);
                  if (ret == null) {
                      way.setInvalid(true);
                      LOGGER.warning("could not repair invalid polygon: " + way.getId());
                  }
              }
          } catch (TopologyException e) {
              LOGGER.log(Level.WARNING, "JTS cannot clip way, not storing it in data file: " + way.getId(), e);
              way.setInvalid(true);
              return null;
          }
          return ret;
      }