Created
April 25, 2015 01:11
-
-
Save mojodna/8aada8afa344ab2e39c4 to your computer and use it in GitHub Desktop.
Vapor clock feeder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
/* eslint-disable no-sync */ | |
"use strict"; | |
var assert = require("assert"), | |
fs = require("fs"), | |
path = require("path"), | |
util = require("util"); | |
var env = require("require-env"), | |
exquisite = require("exquisite"); | |
var argv = process.argv.slice(2); | |
assert.equal(1, argv.length, "A filename argument must be provided"); | |
var queue = exquisite({ | |
name: env.require("SQS_QUEUE_NAME") | |
}).queue; | |
fs.readFileSync(path.join(process.cwd(), argv.shift()), { | |
encoding: "utf8" | |
}) | |
.trim() | |
.split("\n") | |
.forEach(function(filename) { | |
var basename = path.basename(filename, ".zip"), | |
input = util.format("/vsicurl/http://data.stamen.com.s3.amazonaws.com/srtm/hillshade/4326/%s.tiff", basename), | |
output = util.format("s3://data.stamen.com/srtm/hillshade/3857/%s.tiff", basename), | |
task = { | |
name: util.format("Reproject %s hillshade to 3857", basename), | |
input: input, | |
output: output, | |
operations: [ | |
{ | |
type: "reproject", | |
options: { | |
targetSRS: "EPSG:3857", | |
srcNoData: 0, | |
dstNoData: 0 | |
} | |
} | |
] | |
}; | |
queue.queueTask(task, { | |
maxAttempts: 5 | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment