I am attempting to clip DEM rasters (USGS, in WGS 84) into a set of tiles measuring 2.56km on a side, in QGIS, using python.
So far, it appears that gdal_translate is working for me, using a bounding box in latitude/longitude coordinates. My problem is that I need to know how to convert 2.56 km into the equivalent distance in latitude and longitude. Thus far I've been getting by in other applications using the following formula, found online here: http://fmepedia.safe.com/articles/How_To/Calculating-accurate-length-in-meters-for-lat-long-coordinate-systems
rLat = math.radians(mapCenterLat) metersPerDegreeLat = 111132.92 - 559.82 * math.cos(2 * rLat) + 1.175 * math.cos(4 * rLat) metersPerDegreeLong = 111412.84 * math.cos(rLat) - 93.5 * math.cos(3 * rLat) degreesPerMeterLong = 1.0 / metersPerDegreeLong degreesPerMeterLat = 1.0 / metersPerDegreeLat
It's black magic, but it seems like it's worked for me so far. However, in this instance when I plug in that equation, and multiply my resulting degreesPerMeter numbers times 2560, the resulting rectangle ends up being more like 3.45 km wide by 2.49 km high.
Clearly there must be a better way in QGIS to figure this out, without resorting to black magic, right?