Skip to content

Instantly share code, notes, and snippets.

@nickpeihl
Created August 31, 2015 20:48
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 nickpeihl/0cebc5c0652c8630fffa to your computer and use it in GitHub Desktop.
Save nickpeihl/0cebc5c0652c8630fffa to your computer and use it in GitHub Desktop.
GeoTIFF Test for Mapnik-Omnivore
var fs = require('fs');
fs.open('CW.tif', 'r', function(err, fd) {
var buf = new Buffer(100);
fs.read(fd, buf, 0, 100, null, function(err, bytesRead, buffer) {
var head = buffer.slice(0, 100).toString();
if((head.slice(0,2).toString() === 'II' || head.slice(0,2).toString() == 'MM') && ((buffer[2] === 42) || buffer[3] === 42)) {
console.log('file matches GeoTiff');
} else {
console.log('head-slice is ', head.slice(0,2).toString(), ' and buffer[2] equals ', buffer[2], ' and buffer[3] equals ', buffer[3]);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment