Skip to content

Instantly share code, notes, and snippets.

@migurski
Created January 8, 2013 21:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save migurski/4488279 to your computer and use it in GitHub Desktop.
Save migurski/4488279 to your computer and use it in GitHub Desktop.
from itertools import product
radius = 20037508.343
mins = [2 * radius * n/8. - radius for n in range(0, 8)]
maxs = [2 * radius * n/8. - radius for n in range(1, 9)]
edges = zip(mins, maxs)
for (index, ((xmin, xmax), (ymin, ymax))) in enumerate(product(edges, edges)):
fname = 'bering-%d.tif' % index
print 'gdalwarp',
print '-t_srs "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"',
print '-co COMPRESS=JPEG -co JPEG_QUALITY=80',
print '-te', xmin, ymin, xmax, ymax,
print '/var/www/landcover/boston_modis/derived/boston-modis-buffered-rgb.tif',
print fname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment