public boolean isFillOrEdge(boolean allowEdges) {
      if (geomType != GeometryType.POLYGON && (!allowEdges || geomType != GeometryType.LINE)) {
        return false;
      }

      boolean isLine = geomType == GeometryType.LINE;

      int extent = EXTENT << scale;
      int visited = INSIDE;
      int firstX = 0;
      int firstY = 0;
      int x = 0;
      int y = 0;

      int geometryCount = commands.length;
      int length = 0;
      int command = 0;
      int i = 0;
      while (i < geometryCount) {

        if (length <= 0) {
          length = commands[i++];
          command = length & ((1 << 3) - 1);
          length = length >> 3;
          if (isLine && length > 2) {
            return false;
          }
        }

        if (length > 0) {
          if (command == Command.CLOSE_PATH.value) {
            if (isSegmentInvalid(allowEdges, x, y, firstX, firstY, extent) ||
              !visitedEnoughSides(allowEdges, visited)) {
              return false;
            }
            length--;
            continue;
          }

          int dx = commands[i++];
          int dy = commands[i++];

          length--;

          dx = zigZagDecode(dx);
          dy = zigZagDecode(dy);

          int nextX = x + dx;
          int nextY = y + dy;

          if (command == Command.MOVE_TO.value) {
            firstX = nextX;
            firstY = nextY;
            if ((visited = getSide(firstX, firstY, 0, extent)) == INSIDE) {
              return false;
            }
          } else {
            if (isSegmentInvalid(allowEdges, x, y, nextX, nextY, extent)) {
              return false;
            }
            visited |= getSide(nextX, nextY, 0, extent);
          }
          y = nextY;
          x = nextX;
        }

      }

      return visitedEnoughSides(allowEdges, visited);
    }
Returns true if the encoded geometry is a polygon fill, or if {@code allowEdges == true} then also a rectangle
edge, or part of a horizontal/vertical line that is likely to be repeated across tiles.
planetiler-core/src/main/java/com/onthegomap/planetiler/VectorTile.java