{"_id":"@mapbox/geo-pixel-stream","_rev":"256-71af99727c2d563b8e8b8a63da2835c3","name":"@mapbox/geo-pixel-stream","description":"[![Build Status](https://travis-ci.org/mapbox/geo-pixel-stream.svg?branch=master)](https://travis-ci.org/mapbox/geo-pixel-stream)","dist-tags":{"latest":"0.5.0"},"versions":{"0.4.0":{"name":"@mapbox/geo-pixel-stream","version":"0.4.0","description":"[![Build Status](https://travis-ci.org/mapbox/geo-pixel-stream.svg?branch=master)](https://travis-ci.org/mapbox/geo-pixel-stream)","main":"index.js","scripts":{"test":"tape test/*.test.js"},"repository":{"type":"git","url":"git+https://github.com/mapbox/geo-pixel-stream.git"},"author":{"name":"Mapbox"},"license":"ISC","bugs":{"url":"https://github.com/mapbox/geo-pixel-stream/issues"},"homepage":"https://github.com/mapbox/geo-pixel-stream","dependencies":{"gdal":"~0.9.3"},"devDependencies":{"mapnik":"~3.5.14","mapnik-test-data":"https://mapbox-npm.s3.amazonaws.com/package/mapnik-test-data-2.0.3-fece0a9c546074a1479e9eae2333184029bb2279.tgz","mkdirp":"^0.5.0","queue-async":"^1.0.7","tape":"^3.4.0","underscore":"^1.7.0"},"gitHead":"dc498db26625282fd219ca8398dcf60248bf8a4b","_id":"@mapbox/geo-pixel-stream@0.4.0","_shasum":"2ae4c9871056e5031aaebb55fb68a339b13d38a2","_from":".","_npmVersion":"3.10.10","_nodeVersion":"7.2.1","_npmUser":{"name":"tmcw","email":"tom@macwright.org"},"dist":{"shasum":"2ae4c9871056e5031aaebb55fb68a339b13d38a2","tarball":"https://registry.npmjs.org/@mapbox/geo-pixel-stream/-/geo-pixel-stream-0.4.0.tgz","integrity":"sha512-RWc0omqr694uhARH6+m9AqLYA0mIxjvGTBtl248q/LRoBCdRu/lx7K6aPmSC1HPxkV868qeGwT1y5i8qaxF3cQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCKsW3KV0ALU0jVi6qz1bnUJfznt36B/6gdSdN29Dm6pQIgFU5vmRnSzd1H2wL7k1YYWWTW2mzHDal5pWOfa91zZn4="}]},"maintainers":[{"name":"tmcw","email":"tom@macwright.org"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/geo-pixel-stream-0.4.0.tgz_1482440435329_0.555208851583302"},"directories":{}},"0.5.0":{"name":"@mapbox/geo-pixel-stream","version":"0.5.0","description":"[![Build Status](https://travis-ci.org/mapbox/geo-pixel-stream.svg?branch=master)](https://travis-ci.org/mapbox/geo-pixel-stream)","main":"index.js","scripts":{"test":"tape test/*.test.js"},"repository":{"type":"git","url":"git+https://github.com/mapbox/geo-pixel-stream.git"},"author":{"name":"Mapbox"},"license":"ISC","bugs":{"url":"https://github.com/mapbox/geo-pixel-stream/issues"},"homepage":"https://github.com/mapbox/geo-pixel-stream","dependencies":{"gdal":"~0.9.3"},"devDependencies":{"mapnik":"~3.6.0","mapnik-test-data":"https://mapbox-npm.s3.amazonaws.com/package/mapnik-test-data-2.0.3-fece0a9c546074a1479e9eae2333184029bb2279.tgz","mkdirp":"^0.5.0","queue-async":"^1.0.7","tape":"^3.4.0","underscore":"^1.7.0"},"gitHead":"92746051317618644abdb146cdbcb6588e4829ba","_id":"@mapbox/geo-pixel-stream@0.5.0","_shasum":"8adbcf3c343a7701c8c051909e5e1ade187dab00","_from":".","_npmVersion":"2.15.8","_nodeVersion":"4.4.7","_npmUser":{"name":"gretacb","email":"carol@mapbox.com"},"dist":{"shasum":"8adbcf3c343a7701c8c051909e5e1ade187dab00","tarball":"https://registry.npmjs.org/@mapbox/geo-pixel-stream/-/geo-pixel-stream-0.5.0.tgz","integrity":"sha512-QwsPwEI6QobiFzoF1YiY8WW7LCPPfDfI2aGpCzmMpQd0W24GM11GKkSbLvncSDWtGJxpH/pg5gAVranZz3YcGQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCc67C/ujwcmXPOvfx8lox43jEwQI978yy9XUWk+Ud7dgIgKbc6QugcoTnFavmhosQl1JO8h86lEVP/qE4Mh3ugdnY="}]},"maintainers":[{"name":"aaronlidman","email":"aaronlidman@gmail.com"},{"name":"aarthykc","email":"aarthy@mapbox.com"},{"name":"ajashton","email":"aj@mapbox.com"},{"name":"ajithranka","email":"ajith@mapbox.com"},{"name":"aliceykuo","email":"alice@mapbox.com"},{"name":"alinapaz","email":"alinapaz@gmail.com"},{"name":"allierowan","email":"aileen.s.rowan@gmail.com"},{"name":"alulsh","email":"ulsh@mapbox.com"},{"name":"amishas157","email":"amisha@mapbox.com"},{"name":"amyleew","email":"amyleewalton@gmail.com"},{"name":"anandthakker","email":"vestibule@anandthakker.net"},{"name":"andygol","email":"andrey@mapbox.com"},{"name":"ansis","email":"ansis.brammanis@gmail.com"},{"name":"aparlato","email":"alex.parlato@mapbox.com"},{"name":"apendleton","email":"andrew@mapbox.com"},{"name":"arunasank","email":"aruna@mapbox.com"},{"name":"batpad","email":"sanjay@mapbox.com"},{"name":"benjamintd","email":"benjamin@mapbox.com"},{"name":"bhousel","email":"bryan@mapbox.com"},{"name":"bkowshik","email":"bhargav.kowshik@gmail.com"},{"name":"boblannon","email":"blannon@gmail.com"},{"name":"brendanmcfarland","email":"brendan@mapbox.com"},{"name":"bsrinivasa","email":"bharata+npm@mapbox.com"},{"name":"bsudekum","email":"bobby@mapbox.com"},{"name":"calfarome","email":"cesar@mapbox.com"},{"name":"camillacaros","email":"camilla@mapbox.com"},{"name":"captainbarbosa","email":"nadia.barbosa@mapbox.com"},{"name":"chaupow","email":"hello@chau-nguyen.de"},{"name":"chetangowda","email":"chethan@mapbox.com"},{"name":"chrisloer","email":"chris.loer@mapbox.com"},{"name":"colleenmcginnis","email":"colleen.mcginnis@mapbox.com"},{"name":"danieljh","email":"daniel+npm@trvx.org"},{"name":"dannykath","email":"danny@mapbox.com"},{"name":"danpat","email":"danpat@danpat.net"},{"name":"danswick","email":"dan@mapbox.com"},{"name":"dasulit","email":"dana.sulit@mapbox.com"},{"name":"davidtheclark","email":"david.dave.clark@gmail.com"},{"name":"deniskoronchik","email":"denis.koronchik@gmail.com"},{"name":"dnomadb","email":"damon@mapbox.com"},{"name":"drboyer","email":"devin.boyer@mapbox.com"},{"name":"dthompson","email":"dthompson@gmail.com"},{"name":"emilymcafee","email":"emily@mapbox.com"},{"name":"emilymdubois","email":"dubois@mapbox.com"},{"name":"enf","email":"fischer@mapbox.com"},{"name":"fa7c0n","email":"gokul.ganesan@mapbox.com"},{"name":"flippmoke","email":"flippmoke@gmail.com"},{"name":"freenerd","email":"spam@freenerd.de"},{"name":"geohacker","email":"sajjadkm@gmail.com"},{"name":"ghoshkaj","email":"ghoshkaj@gmail.com"},{"name":"gretacb","email":"carol@mapbox.com"},{"name":"ian29","email":"ian.villeda@gmail.com"},{"name":"ianshward","email":"ian@mapbox.com"},{"name":"ilyasaf","email":"safonov.ilya@gmail.com"},{"name":"ingalls","email":"nicholas.ingalls@gmail.com"},{"name":"isiyu","email":"siyu.song@gmail.com"},{"name":"jacquestardie","email":"hi@jacquestardie.org"},{"name":"jfirebaugh","email":"john.firebaugh@gmail.com"},{"name":"jothirnadh","email":"jothirnadh@mapbox.com"},{"name":"jrpruit1","email":"jake@jakepruitt.com"},{"name":"k-mahoney","email":"kara.e.mahoney@gmail.com"},{"name":"kaibot3000","email":"kai@mapbox.com"},{"name":"kaidalgleish","email":"kai@mapbox.com"},{"name":"karenzshea","email":"karen@mapbox.com"},{"name":"karitotp","email":"karito@mapbox.com"},{"name":"katydecorah","email":"decorah@mapbox.com"},{"name":"kepta","email":"0o3ko0@gmail.com"},{"name":"kkaefer","email":"mail@kkaefer.com"},{"name":"kronick","email":"sam.kronick@mapbox.com"},{"name":"l-r","email":"laurier@mapbox.com"},{"name":"laurier","email":"l@pwd.io"},{"name":"lbud","email":"lauren@mapbox.com"},{"name":"lily-chai","email":"lily@mapbox.com"},{"name":"lndsay","email":"lindsay@mapbox.com"},{"name":"lucaswoj","email":"lucas@lucaswoj.com"},{"name":"lukasmartinelli","email":"me@lukasmartinelli.ch"},{"name":"lxbarth","email":"alex@mapbox.com"},{"name":"lyzidiamond","email":"lyzi@mapbox.com"},{"name":"maning","email":"emmanuel.sambale@gmail.com"},{"name":"manoharuss","email":"manohar@mapbox.com"},{"name":"mapbox-admin","email":"accounts@mapbox.com"},{"name":"mapbox-machine-user","email":"accounts+npm-mapbox-machine-user@mapbox.com"},{"name":"mapsam","email":"sam@mapbox.com"},{"name":"mateov","email":"matt@mapbox.com"},{"name":"mattficke","email":"matt@mattficke.com"},{"name":"mayaqgao","email":"mayaqgao@gmail.com"},{"name":"mcwhittemore","email":"mcwhittemore@gmail.com"},{"name":"miccolis","email":"jeff@miccolis.net"},{"name":"miles-dev","email":"miles.sackler@mapbox.com"},{"name":"mokob","email":"moritz@mapbox.com"},{"name":"mollymerp","email":"mollylloyd@gmail.com"},{"name":"morganherlocker","email":"morgan.herlocker@gmail.com"},{"name":"mourner","email":"agafonkin@gmail.com"},{"name":"msirenko","email":"max@mapbox.com"},{"name":"nammala","email":"krishna@mapbox.com"},{"name":"natslaughter","email":"nat@mapbox.com"},{"name":"nickcordella","email":"nick.cordella@mapbox.com"},{"name":"nickidlugash","email":"nicki@mapbox.com"},{"name":"nikhilprabhakar","email":"nikinfour@gmail.com"},{"name":"oini","email":"oindrila.gupta92@gmail.com"},{"name":"oliikit","email":"olivia.brundage@mapbox.com"},{"name":"oxidase","email":"michael.krasnyk@gmail.com"},{"name":"patjouk","email":"lucie.daeye@mapbox.com"},{"name":"pdgoodman","email":"paul@mapbox.com"},{"name":"perrygeo","email":"perrygeo@gmail.colm"},{"name":"peterqliu","email":"peterqliu@gmail.com"},{"name":"planemad","email":"arun.planemad@gmail.com"},{"name":"pratikyadav","email":"pratik@mapbox.com"},{"name":"rasagy","email":"rasagy@mapbox.com"},{"name":"rclark","email":"ryan.clark.j@gmail.com"},{"name":"richrico","email":"richman@mapbox.com"},{"name":"ridixcr","email":"pavel@mapbox.com"},{"name":"rub21","email":"ruben@mapbox.com"},{"name":"rumc","email":"r.ragupathy85@gmail.com"},{"name":"ryan-baumann","email":"rsbaumann@gmail.com"},{"name":"saikia.abhishek","email":"abhishek@mapbox.com"},{"name":"samanbb","email":"saman@mapbox.com"},{"name":"samely","email":"eliane@mapbox.com"},{"name":"sarahkleins","email":"sarah.kleinman@mapbox.com"},{"name":"sbma44","email":"tlee@mapbox.com"},{"name":"scothis","email":"scothis@gmail.com"},{"name":"sgillies","email":"sean@mapbox.com"},{"name":"springmeyer","email":"dane@mapbox.com"},{"name":"srividyacb","email":"srividyabharadwaj26@gmail.com"},{"name":"tcql","email":"tim.channell@gmail.com"},{"name":"themarex","email":"patrick@mapbox.com"},{"name":"tony-cj","email":"tony.chen@mapbox.com"},{"name":"tristen","email":"tristen.brown@gmail.com"},{"name":"upendrayadav","email":"upendra@mapbox.com"},{"name":"uvollmer","email":"ugo.vollmer@mapbox.com"},{"name":"vincents","email":"vincent.sarago@mapbox.com"},{"name":"virginiayung","email":"virginia@mapbox.com"},{"name":"willwhite","email":"will@mapbox.com"},{"name":"xrwang","email":"xiaowei@mapbox.com"},{"name":"yhahn","email":"young@mapbox.com"},{"name":"yunjieli","email":"yunjie.li@mapbox.com"},{"name":"zmully","email":"mully@mapbox.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/geo-pixel-stream-0.5.0.tgz_1492778241813_0.6122026666998863"},"directories":{}}},"readme":"# geo-pixel-stream\n\n[![Build Status](https://travis-ci.org/mapbox/geo-pixel-stream.svg?branch=master)](https://travis-ci.org/mapbox/geo-pixel-stream)\n\n[wip] Node.js streams for reading/writing/transforming pixels using node-gdal\n\n## PixelReader streams\n\nCreate streams that read pixels from each band of a source image:\n\n```js\nvar pixels = require('@mapbox/geo-pixel-stream');\nvar dcrgb = 'node_modules/mapnik-test-data/data/geotiff/DC_rgb.tif';\nvar readers = pixels.createReadStreams(dcrgb);\n```\n\nIf an image has 4 bands (e.g. RGBA), then the `streams` array will contain four stream objects. Each stream contains metadata about the original datasource and the band represented:\n\n```js\nconsole.log(readers[0].metadata);\n// {\n//   driver: 'GTiff',\n//   width: 1541,\n//   height: 1913,\n//   numBands: 4,\n//   srs: gdal.SpatialReference.fromEPSG(26918),\n//   geotransform: [ 326356, 4.00129785853342, 0, 4318980, 0, -4.0015682174594875 ],\n//   id: 1,\n//   type: 'Byte',\n//   blockSize: {\n//     x: 1541,\n//     y: 1\n//   }\n// }\n```\n\nEach PixelReader is a [Node.js readable stream](http://nodejs.org/api/stream.html#stream_class_stream_readable). The stream's `data` event will emit objects indicating the offset (in terms of blocks, not pixels), block size (in pixels) and a TypedArray of pixel data.\n\n```js\nreaders[0].once('data', function(data) {\n  console.log(data);\n  // {\n  //   offset: { x: 0, y: 0 },\n  //   blockSize: { x: 1541, y: 1 },\n  //   buffer: [ Uint8TypedArray ]\n  // }\n});\n```\n\n[Inheriting from the stream api](http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options), PixelReaders can send data to writable streams via `pipe`:\n\n```js\nvar writable = new stream.Writable();\nreaders[1].pipe(writable);\n```\n\n## PixelWriter streams\n\nCreate streams that write pixels from each band of a destination image:\n\n```js\nvar outputFile = '~/some.tif';\nvar writers = pixels.createWriteStreams(outputFile);\n```\n\nAgain, if this will generate one stream for each band of the output file. If, instead of writing to an existing file, you want to write to a new, blank image, you must provide sufficient metadata to generate the new image:\n```js\nvar outfile = '~/just-red-pixels.tif'\nvar outputMetadata = {\n  driver: 'GTiff',\n  width: 1541,\n  height: 1913,\n  numBands: 1,\n  srs: gdal.SpatialReference.fromEPSG(26918),\n  geotransform: [ 326356, 4.00129785853342, 0, 4318980, 0, -4.0015682174594875 ],\n  id: 1,\n  type: 'Byte',\n  blockSize: { x: 1541, y: 1 }\n};\nvar writers = pixels.createWriteStreams(outputFile, outputMetadata);\n```\n\nOnce you've created readers and writers, you can `pipe` data from one image to another:\n\n```js\nvar dcrgb = 'node_modules/mapnik-test-data/data/geotiff/DC_rgb.tif';\nvar readers = pixels.createReadStreams(dcrgb);\nvar readRedBand = readers[0];\n\nvar writers = pixels.createWriteStreams(outputFile);\nvar writeRedBand = writers[0];\n\nreadRedBand.pipe(writeRedBand).on('finish', function() {\n  console.log('All done!');\n});\n```\n\n## PixelTransform streams\n\nCreate a stream that takes input pixels, performs some sort of manipulation of them, and outputs the adjusted pixels. You create a function that will receive a TypedArray of pixels, performs some adjustment, and provides the adjusted pixels to the provided `callback` function:\n\n```js\nfunction processPixels(buffer, callback) {\n  var result = buffer.map(function(pixel) {\n    return pixel + 10;\n  });\n  callback(null, result);\n}\n\nvar transform = pixels.createTransformStream(processPixels);\n```\n\nIf processing encounters an error, send the error as the first argument to the provided `callback` function.\n\nYou can use a transform stream to make adjustments to pixel values before writing them to a destination file:\n\n```js\nvar dcrgb = 'node_modules/mapnik-test-data/data/geotiff/DC_rgb.tif';\nvar readers = pixels.createReadStreams(dcrgb);\nvar writers = pixels.createWriteStreams(outputFile);\nvar transform = pixels.createTransformStream(processPixels);\n\nreaders[0].pipe(transform).pipe(writers[0]).on('close', function() {\n  console.log('All done!');\n});\n```\n","maintainers":[{"email":"yannick.meeus+npm+production+ci@mapbox.com","name":"mbx-npm-ci-production"},{"email":"yannick.meeus+npm+staging+ci@mapbox.com","name":"mbx-npm-ci-staging"},{"email":"yannick.meeus+npm+prod+advanced+actions@mapbox.com","name":"mbx-npm-advanced-actions-production"},{"email":"yannick.meeus+npm+staging+advanced+actions@mapbox.com","name":"mbx-npm-advanced-actions-staging"},{"email":"yannick.meeus+npm+prod+09@mapbox.com","name":"mbx-npm-09-production"},{"email":"yannick.meeus+npm+prod+08@mapbox.com","name":"mbx-npm-08-production"},{"email":"yannick.meeus+npm+prod+07@mapbox.com","name":"mbx-npm-07-production"},{"email":"yannick.meeus+npm+prod+06@mapbox.com","name":"mbx-npm-06-production"},{"email":"yannick.meeus+npm+prod+05@mapbox.com","name":"mbx-npm-05-production"},{"email":"yannick.meeus+npm+prod+04@mapbox.com","name":"mbx-npm-04-production"},{"email":"yannick.meeus+npm+prod+03@mapbox.com","name":"mbx-npm-03-production"},{"email":"yannick.meeus+npm+prod+02@mapbox.com","name":"mbx-npm-02-production"},{"email":"yannick.meeus+npm+prod+01@mapbox.com","name":"mbx-npm-01-production"},{"email":"yannick.meeus@mapbox.com","name":"mbx-npm-02-staging"},{"email":"accounts+npmjs-01@mapbox.com","name":"mapbox-npm-01"},{"email":"accounts+npmjs-02@mapbox.com","name":"mapbox-npm-02"},{"email":"accounts+npmjs-07@mapbox.com","name":"mapbox-npm-07"},{"email":"accounts+npmjs-03@mapbox.com","name":"mapbox-npm-03"},{"email":"accounts+npmjs-04@mapbox.com","name":"mapbox-npm-04"},{"email":"accounts+npmjs-09@mapbox.com","name":"mapbox-npm-09"},{"email":"accounts+npmjs-05@mapbox.com","name":"mapbox-npm-05"},{"email":"accounts+npmjs-06@mapbox.com","name":"mapbox-npm-06"},{"email":"accounts+npmjs-08@mapbox.com","name":"mapbox-npm-08"},{"email":"accounts+npmjs-advanced-actions@mapbox.com","name":"mapbox-npm-advanced-actions"},{"email":"accounts+npmjs-npm-ci@mapbox.com","name":"mapbox-npm-ci"},{"email":"accounts+npmjs@mapbox.com","name":"mapbox-npm"},{"email":"accounts@mapbox.com","name":"mapbox-admin"},{"email":"accounts+npm-mapbox-machine-user@mapbox.com","name":"mapbox-machine-user"}],"time":{"modified":"2023-01-12T12:42:11.938Z","created":"2016-12-22T21:00:36.040Z","0.4.0":"2016-12-22T21:00:36.040Z","0.5.0":"2017-04-21T12:37:22.477Z"},"homepage":"https://github.com/mapbox/geo-pixel-stream","repository":{"type":"git","url":"git+https://github.com/mapbox/geo-pixel-stream.git"},"author":{"name":"Mapbox"},"bugs":{"url":"https://github.com/mapbox/geo-pixel-stream/issues"},"license":"ISC","readmeFilename":"readme.md"}