code: public AffineTransform metersToTilePixelsTransform(int tx, int ty, int zoomLevel) {
          AffineTransform result = new AffineTransform();
          double scale = 1.0 / resolution(zoomLevel);
          int nTiles = 2 << (zoomLevel - 1);
          int px = tx * -256;
          int py = (nTiles - ty) * -256;
          // flip y for upper-left origin
          result.scale(1, -1);
          result.translate(px, py);
          result.scale(scale, scale);
          result.translate(originShift, originShift);
          return result;
      }
docs: Create a transform that converts meters to tile-relative pixels
  
  @param tx        The x coordinate of the tile
  @param ty        The y coordinate of the tile
  @param zoomLevel the zoom level
  @return AffineTransform with meters to pixels transformation