Created
August 31, 2015 20:48
-
-
Save nickpeihl/0cebc5c0652c8630fffa to your computer and use it in GitHub Desktop.
GeoTIFF Test for Mapnik-Omnivore
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
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