code: public static double calculateGroundResolutionWithScaleFactor(double latitude, double scaleFactor, int tileSize) {
          long mapSize = getMapSizeWithScaleFactor(scaleFactor, tileSize);
          return Math.cos(latitude * (Math.PI / 180)) * EARTH_CIRCUMFERENCE / mapSize;
      }
docs: Calculates the distance on the ground that is represented by a single pixel on the map.
  
  @param latitude    the latitude coordinate at which the resolution should be calculated.
  @param scaleFactor the scale at which the resolution should be calculated.
  @return the ground resolution at the given latitude and scale.