{"_id":"@davisg123/mbgl-renderer","_rev":"6-f081d752737c0cc01dac7d18bbc40403","name":"@davisg123/mbgl-renderer","dist-tags":{"latest":"1.0.5"},"versions":{"1.0.1":{"name":"@davisg123/mbgl-renderer","version":"1.0.1","description":"Static Map Renderer using Mapbox GL, with updated node binaries","main":"dist/index.js","license":"ISC","scripts":{"build":"babel ./src -d ./dist","start":"babel-node ./src/server.js","watch":"babel --watch ./src -d ./dist","test":"jest --coverage","prepublish":"babel ./src -d ./dist"},"bin":{"mbgl-render":"dist/cli.js","mbgl-server":"dist/server.js"},"dependencies":{"@babel/runtime":"^7.7.2","@mapbox/geo-viewport":"^0.4.0","@naturalatlas/mapbox-gl-native":"^1.0.2","@mapbox/mbtiles":"^0.11.0","commander":"^3.0.2","morgan":"^1.10.0","node-restify-validation":"^1.3.0","request":"^2.87.0","restify":"^8.4.0","restify-errors":"^8.0.1","sharp":"^0.23.2"},"devDependencies":{"@babel/cli":"^7.7.0","@babel/core":"^7.7.2","@babel/node":"^7.7.0","@babel/plugin-transform-runtime":"^7.6.2","@babel/preset-env":"^7.7.1","babel-eslint":"^10.0.3","babel-jest":"^24.9.0","babel-preset-jest":"^24.9.0","dotenv":"^8.2.0","dotenv-flow":"^3.1.0","eslint":"^6.6.0","eslint-config-airbnb-base":"^14.0.0","eslint-config-prettier":"^6.5.0","eslint-plugin-import":"^2.18.2","eslint-plugin-jsx-a11y":"^6.2.3","eslint-plugin-prettier":"^3.1.1","jest":"^24.9.0","jest-fixtures":"^0.6.0","pixelmatch":"^5.1.0"},"repository":{"type":"git","url":"git+https://github.com/consbio/mbgl-renderer.git"},"gitHead":"2ccf22e896dd066b077343b06effdabe37b8dcae","bugs":{"url":"https://github.com/consbio/mbgl-renderer/issues"},"homepage":"https://github.com/consbio/mbgl-renderer#readme","_id":"@davisg123/mbgl-renderer@1.0.1","_nodeVersion":"10.24.1","_npmVersion":"7.24.2","dist":{"integrity":"sha512-dL2uW0Qq4OClzBdfTlmi5qZ8JFetsgcMa7J+jJcXFnAW2CyNZ/snfTZEDBOXNXTNgYDHGLrRBvYFUm2Jrd1Ucg==","shasum":"6083b0e59b23f9a7a968df9295dff0bdcc1d9fea","tarball":"https://registry.npmjs.org/@davisg123/mbgl-renderer/-/mbgl-renderer-1.0.1.tgz","fileCount":54,"unpackedSize":1975366,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDswKiYPNyPCyCe4lNG5gpfIVFdKg59kDomtdAc2pIe4AiEAlL3ykT3a82KdTDBqi94IiF7Fu5b0T9470kZtsV+Sx5U="}]},"_npmUser":{"name":"dgossage","email":"davisgossage@gmail.com"},"directories":{},"maintainers":[{"name":"dgossage","email":"davisgossage@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mbgl-renderer_1.0.1_1635192836326_0.8080670366747305"},"_hasShrinkwrap":false},"1.0.2":{"name":"@davisg123/mbgl-renderer","version":"1.0.2","description":"Static Map Renderer using Mapbox GL, with updated node binaries","main":"dist/index.js","license":"ISC","scripts":{"build":"babel ./src -d ./dist","start":"babel-node ./src/server.js","watch":"babel --watch ./src -d ./dist","test":"jest --coverage","prepublish":"babel ./src -d ./dist"},"bin":{"mbgl-render":"dist/cli.js","mbgl-server":"dist/server.js"},"dependencies":{"@babel/runtime":"^7.7.2","@mapbox/geo-viewport":"^0.4.0","@naturalatlas/mapbox-gl-native":"^1.0.2","@mapbox/mbtiles":"^0.11.0","commander":"^3.0.2","morgan":"^1.10.0","node-restify-validation":"^1.3.0","request":"^2.87.0","restify":"^8.4.0","restify-errors":"^8.0.1","sharp":"^0.23.2"},"devDependencies":{"@babel/cli":"^7.7.0","@babel/core":"^7.7.2","@babel/node":"^7.7.0","@babel/plugin-transform-runtime":"^7.6.2","@babel/preset-env":"^7.7.1","babel-eslint":"^10.0.3","babel-jest":"^24.9.0","babel-preset-jest":"^24.9.0","dotenv":"^8.2.0","dotenv-flow":"^3.1.0","eslint":"^6.6.0","eslint-config-airbnb-base":"^14.0.0","eslint-config-prettier":"^6.5.0","eslint-plugin-import":"^2.18.2","eslint-plugin-jsx-a11y":"^6.2.3","eslint-plugin-prettier":"^3.1.1","jest":"^24.9.0","jest-fixtures":"^0.6.0","pixelmatch":"^5.1.0"},"repository":{"type":"git","url":"git+https://github.com/consbio/mbgl-renderer.git"},"gitHead":"7909a909106699e391f2e67b48ccecf0749218b3","bugs":{"url":"https://github.com/consbio/mbgl-renderer/issues"},"homepage":"https://github.com/consbio/mbgl-renderer#readme","_id":"@davisg123/mbgl-renderer@1.0.2","_nodeVersion":"10.24.1","_npmVersion":"7.24.2","dist":{"integrity":"sha512-LUrdMSctxmB9Ra+StWtqk80G+yG16azyVWyERfHsoFHQpDd9M/u8j3P4IgQauLy6Es6zHsG5nR2K5q0MNPiU/A==","shasum":"8cb46f6369f0623a3f15f41402ef6d6d922fcf79","tarball":"https://registry.npmjs.org/@davisg123/mbgl-renderer/-/mbgl-renderer-1.0.2.tgz","fileCount":54,"unpackedSize":1975372,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICiFjEs3I+rldfATwbd4Q8bNgk3+1S5JvzhMNT1BqwaJAiAT4teXV2OTcu90pOp5wtE8gOcutoqSk+LJuTFUCdN3LQ=="}]},"_npmUser":{"name":"dgossage","email":"davisgossage@gmail.com"},"directories":{},"maintainers":[{"name":"dgossage","email":"davisgossage@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mbgl-renderer_1.0.2_1635193482848_0.8340533039158873"},"_hasShrinkwrap":false},"1.0.3":{"name":"@davisg123/mbgl-renderer","version":"1.0.3","description":"Static Map Renderer using Mapbox GL, with updated node binaries","main":"dist/index.js","license":"ISC","scripts":{"build":"babel ./src -d ./dist","start":"babel-node ./src/server.js","watch":"babel --watch ./src -d ./dist","test":"jest --coverage","prepublish":"babel ./src -d ./dist"},"bin":{"mbgl-render":"dist/cli.js","mbgl-server":"dist/server.js"},"dependencies":{"@babel/runtime":"^7.7.2","@mapbox/geo-viewport":"^0.4.0","@naturalatlas/mapbox-gl-native":"^1.0.2","@mapbox/mbtiles":"^0.11.0","commander":"^3.0.2","morgan":"^1.10.0","node-restify-validation":"^1.3.0","request":"^2.87.0","restify":"^8.4.0","restify-errors":"^8.0.1","sharp":"^0.23.2"},"devDependencies":{"@babel/cli":"^7.7.0","@babel/core":"^7.7.2","@babel/node":"^7.7.0","@babel/plugin-transform-runtime":"^7.6.2","@babel/preset-env":"^7.7.1","babel-eslint":"^10.0.3","babel-jest":"^24.9.0","babel-preset-jest":"^24.9.0","dotenv":"^8.2.0","dotenv-flow":"^3.1.0","eslint":"^6.6.0","eslint-config-airbnb-base":"^14.0.0","eslint-config-prettier":"^6.5.0","eslint-plugin-import":"^2.18.2","eslint-plugin-jsx-a11y":"^6.2.3","eslint-plugin-prettier":"^3.1.1","jest":"^24.9.0","jest-fixtures":"^0.6.0","pixelmatch":"^5.1.0"},"repository":{"type":"git","url":"git+https://github.com/consbio/mbgl-renderer.git"},"gitHead":"7909a909106699e391f2e67b48ccecf0749218b3","bugs":{"url":"https://github.com/consbio/mbgl-renderer/issues"},"homepage":"https://github.com/consbio/mbgl-renderer#readme","_id":"@davisg123/mbgl-renderer@1.0.3","_nodeVersion":"10.24.1","_npmVersion":"7.24.2","dist":{"integrity":"sha512-ZscEilBmQ4Sg2jDH+yXoutt+KgHqbbOVHumVOLH8JOiCRugvEVoq3wNMUp3dN3dq1p07vFuovqtd32UDffE2ug==","shasum":"e949250afa053ce2763b4df974bf2f74957f18d1","tarball":"https://registry.npmjs.org/@davisg123/mbgl-renderer/-/mbgl-renderer-1.0.3.tgz","fileCount":54,"unpackedSize":1975378,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCID1edkFhUsGlvGcXB1IB2KVasRKXHCJXLyWVq7TU9QyvAiB87E9duPYFfhRUzse6wCb7Od/0s2F8u9AWEpKE4kSdcg=="}]},"_npmUser":{"name":"dgossage","email":"davisgossage@gmail.com"},"directories":{},"maintainers":[{"name":"dgossage","email":"davisgossage@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mbgl-renderer_1.0.3_1635194840830_0.07336555539906486"},"_hasShrinkwrap":false},"1.0.4":{"name":"@davisg123/mbgl-renderer","version":"1.0.4","description":"Static Map Renderer using Mapbox GL","main":"dist/index.js","license":"ISC","scripts":{"build":"babel ./src -d ./dist","start":"babel-node ./src/server.js","watch":"babel --watch ./src -d ./dist","test":"jest --coverage","prepublish":"babel ./src -d ./dist"},"bin":{"mbgl-render":"dist/cli.js","mbgl-server":"dist/server.js"},"dependencies":{"@babel/runtime":"^7.7.2","@mapbox/geo-viewport":"^0.4.0","@mapbox/mapbox-gl-native":"^5.0.2","@mapbox/mbtiles":"^0.11.0","commander":"^3.0.2","morgan":"^1.10.0","node-restify-validation":"^1.3.0","request":"^2.87.0","restify":"^8.4.0","restify-errors":"^8.0.1","sharp":"^0.23.2"},"devDependencies":{"@babel/cli":"^7.7.0","@babel/core":"^7.7.2","@babel/node":"^7.7.0","@babel/plugin-transform-runtime":"^7.6.2","@babel/preset-env":"^7.7.1","babel-eslint":"^10.0.3","babel-jest":"^24.9.0","babel-preset-jest":"^24.9.0","dotenv":"^8.2.0","dotenv-flow":"^3.1.0","eslint":"^6.6.0","eslint-config-airbnb-base":"^14.0.0","eslint-config-prettier":"^6.5.0","eslint-plugin-import":"^2.18.2","eslint-plugin-jsx-a11y":"^6.2.3","eslint-plugin-prettier":"^3.1.1","jest":"^24.9.0","jest-fixtures":"^0.6.0","pixelmatch":"^5.1.0"},"repository":{"type":"git","url":"git+https://github.com/consbio/mbgl-renderer.git"},"gitHead":"8f805be8806b16fc2ed4f92b5118b3e8b7a1d3ad","bugs":{"url":"https://github.com/consbio/mbgl-renderer/issues"},"homepage":"https://github.com/consbio/mbgl-renderer#readme","_id":"@davisg123/mbgl-renderer@1.0.4","_nodeVersion":"10.24.1","_npmVersion":"7.24.2","dist":{"integrity":"sha512-m56w13s1ToDk552aeJzA2firScCjzfIYtJ+dyo+wR5EPhiQhIbvXqtQefx2bobNeHxLjSXUI9L7dNLxDPMYD1Q==","shasum":"68a1a6892fc36edf3d73bf9bb966e097c4419e71","tarball":"https://registry.npmjs.org/@davisg123/mbgl-renderer/-/mbgl-renderer-1.0.4.tgz","fileCount":54,"unpackedSize":1975420,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDu0hHva3PZMGWFS+y1QrEeB/WPXtkoDa28+YTAP5C5ggIhAKFXUCbxW9Yn4mEQStKGJlbQmYJx+mBBG2cu+C1u0NVv"}]},"_npmUser":{"name":"dgossage","email":"davisgossage@gmail.com"},"directories":{},"maintainers":[{"name":"dgossage","email":"davisgossage@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mbgl-renderer_1.0.4_1635819605648_0.01742756768886977"},"_hasShrinkwrap":false},"1.0.5":{"name":"@davisg123/mbgl-renderer","version":"1.0.5","description":"Static Map Renderer using Mapbox GL","main":"dist/index.js","license":"ISC","scripts":{"build":"babel ./src -d ./dist","start":"babel-node ./src/server.js","watch":"babel --watch ./src -d ./dist","test":"jest --coverage","prepublish":"babel ./src -d ./dist"},"bin":{"mbgl-render":"dist/cli.js","mbgl-server":"dist/server.js"},"dependencies":{"@babel/runtime":"^7.7.2","@mapbox/geo-viewport":"^0.4.0","@mapbox/mapbox-gl-native":"^5.0.2","@mapbox/mbtiles":"^0.11.0","commander":"^3.0.2","morgan":"^1.10.0","node-restify-validation":"^1.3.0","request":"^2.87.0","restify":"^8.4.0","restify-errors":"^8.0.1","sharp":"^0.23.2"},"devDependencies":{"@babel/cli":"^7.7.0","@babel/core":"^7.7.2","@babel/node":"^7.7.0","@babel/plugin-transform-runtime":"^7.6.2","@babel/preset-env":"^7.7.1","babel-eslint":"^10.0.3","babel-jest":"^24.9.0","babel-preset-jest":"^24.9.0","dotenv":"^8.2.0","dotenv-flow":"^3.1.0","eslint":"^6.6.0","eslint-config-airbnb-base":"^14.0.0","eslint-config-prettier":"^6.5.0","eslint-plugin-import":"^2.18.2","eslint-plugin-jsx-a11y":"^6.2.3","eslint-plugin-prettier":"^3.1.1","jest":"^24.9.0","jest-fixtures":"^0.6.0","pixelmatch":"^5.1.0"},"repository":{"type":"git","url":"git+https://github.com/consbio/mbgl-renderer.git"},"gitHead":"8f805be8806b16fc2ed4f92b5118b3e8b7a1d3ad","bugs":{"url":"https://github.com/consbio/mbgl-renderer/issues"},"homepage":"https://github.com/consbio/mbgl-renderer#readme","_id":"@davisg123/mbgl-renderer@1.0.5","_nodeVersion":"10.24.1","_npmVersion":"7.24.2","dist":{"integrity":"sha512-f0VGgjkeK60ROX5Mi9mlEQRh5A8o8qeE7LpiQ0Fd3q0mt53P1V8r7F5sLrWpfz9dyDH5EtDpvkHW4O6+b8COxg==","shasum":"44a1467e0e867b524898470c82bd35a1f902b08d","tarball":"https://registry.npmjs.org/@davisg123/mbgl-renderer/-/mbgl-renderer-1.0.5.tgz","fileCount":54,"unpackedSize":1975420,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhzsjyCRA9TVsSAnZWagAAVXsP/REEOd0XLrXEBzwlskps\n5gSeOD5Isto2k7L54PvFA+M/gcBNyBppySj3A2c4/ZrVCohvuZ4a1fj3AFS9\nYkwC/YGC7O/CVXC6lvDBKxXJILZn206nVvBl/rdEwXW0sgU+tDFeKuzoTD+p\nxPhccP7NbQdxXsA9mdQIsjLLMZR73TOjvJb94+JJKaXqPG+xdRoWzz53ZtY0\nxkwSJRaYXDS/TfcaKz8+eFVo8oZByOFDqIWHb+/VOlyY7jWnl00d3tuwKaO6\niXft3BEoLUgUtrZLGB1kmYluBKT96Bf8vonFpE9ejf598e+k4QAUfcc2Zi2M\nsh86eTQqleheYfrnNyXuwwXDjU1VPeM5YQLF528jPAL0+FIGHyITM7jPHSZW\nqmHv0bnMiwSjrurs0aN/yWWKHhrWGwkH8UMCnkgtPFOaNL6M5aOMFilV6ma5\nsRLLCJ69Yvr5WHuHhsseeipTQ4lxbBIimE0McqQZeODmAmQdIahQRKnagycP\nA31/1fN3Yq5Bw+dX14Hr/8SqBpxwx8ShDtt+2/ndAAKp38A2FcfvFlHtjXYN\nuU1gedLsjQaQNbHtiGLdPNRBCGuWFNNGtGZrz/4C5Pei4rL8q9W3eF13EeSj\n0TKXmqO1NrdMr7odvU2c/FOVA/1GV4jh1inb2WzUQ3BvJGpyFzrKCpVCVqoN\nomDo\r\n=Sct1\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDBSuvlItzxzbeZ35OtK7dcnzyt7WAtEL01fuHmWoV05AiBUSLfMGl5qhHZXmHOZqR9UCbBw0PvNhuNnydzaIcOlow=="}]},"_npmUser":{"name":"dgossage","email":"davisgossage@gmail.com"},"directories":{},"maintainers":[{"name":"dgossage","email":"davisgossage@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mbgl-renderer_1.0.5_1636238292064_0.09049531542392275"},"_hasShrinkwrap":false}},"time":{"created":"2021-10-25T20:13:56.273Z","1.0.1":"2021-10-25T20:13:56.527Z","modified":"2022-04-05T03:10:39.438Z","1.0.2":"2021-10-25T20:24:43.154Z","1.0.3":"2021-10-25T20:47:21.142Z","1.0.4":"2021-11-02T02:20:05.927Z","1.0.5":"2021-11-06T22:38:12.287Z"},"maintainers":[{"name":"dgossage","email":"davisgossage@gmail.com"}],"description":"Static Map Renderer using Mapbox GL","homepage":"https://github.com/consbio/mbgl-renderer#readme","repository":{"type":"git","url":"git+https://github.com/consbio/mbgl-renderer.git"},"bugs":{"url":"https://github.com/consbio/mbgl-renderer/issues"},"license":"ISC","readme":"# Static Map Renderer using Mapbox GL\n\n[![Build Status](https://travis-ci.org/consbio/mbgl-renderer.svg?branch=master)](https://travis-ci.org/consbio/mbgl-renderer)\n\n[![Coverage Status](https://coveralls.io/repos/github/consbio/mbgl-renderer/badge.svg?branch=master)](https://coveralls.io/github/consbio/mbgl-renderer?branch=master)\n\nCreate static map images using Mapbox GL with a command line interface, an HTTP interface, and a NodeJS API.\n\n## Features:\n\n-   Render static maps using NodeJS with [mapbox-gl-native](https://github.com/mapbox/mapbox-gl-native)\n-   Supports raster and vector tiles\n-   Compatible with Mapbox tiles (don't forget attribution) and other hosted tile providers\n-   Use locally hosted mbtiles\n-   Add GeoJSON overlays to your maps\n-   Supports high DPI rendering\n-   Also available for use in Docker\n\n[Blog post](https://medium.com/@brendan_ward/creating-a-static-map-renderer-using-the-mapbox-gl-native-nodejs-api-23db560b219e) describing the background and goals in a bit more detail.\n\nOne of the nifty features of this package is that you can use locally hosted mbtiles files\nwith your raster or vector tiles. This saves considerable time during rendering compared\nto using map services over the web.\n\nThis package is intended to help with generating static maps for download or use in reports,\nespecially when combined with your own styles or overlays.\n\nIf you are only using hosted Mapbox styles and vector tiles, please use the [Mapbox Static API](https://www.mapbox.com/api-documentation/#static) instead; it is more full featured and more\nappropriate for static Mapbox maps.\n\n### Attribution\n\nPlease make sure to give appropriate attribution to the data sources and styles used in your maps,\nin the manner that those providers specify.\n\nIf you use Mapbox styles or hosted tiles, make sure to include appropriate [attribution](https://www.mapbox.com/help/how-attribution-works/) in your output maps.\n\n## Installation\n\n`npm add mbgl-renderer`\nor\n`npm install mbgl-renderer`\n\n### Supported versions of NodeJS:\n\n-   8\n-   10\n\nNode 10 appears fully supported by the latest version of Mapbox GL. Originally, there were several issues when running on Node 10, causing segmentation faults and other errors. If you experience issues, we recommend using Node 8.\n\nOnly NodeJS versions with `@mapbox/mapbox-gl-native` binaries built by Mapbox are supported via `npm install`, otherwise you need to build `@mapbox/mapbox-gl-native` from source yourself. See [build instructions](https://github.com/mapbox/mapbox-gl-native/blob/master/platform/node/DEVELOPING.md) for more information.\n\nOn a server, in addition to build tools, you need to install a GL environment. See the `Dockerfile` and `entrypoint.sh` for an example setup.\n\n## Usage\n\n### Style JSON:\n\nThe primary input to every map rendering method below is a Mapbox GL Style JSON file.\nFor full reference on this format, please see the [Mapbox documentation](https://docs.mapbox.com/mapbox-gl-js/style-spec/).\n\n### Labels\n\nIn order to use text labels, you need to include `glyphs` in your Style JSON (sibling of `sources`)\n\nTo use Mapbox hosted glyphs (a Mapbox token is required):\n\n```json\n\"glyphs\": \"mapbox://fonts/mapbox/{fontstack}/{range}.pbf\"\n```\n\nYou can also use [OpenMapTiles hosted glyphs](https://github.com/openmaptiles/fonts):\n\n```json\n\"glyphs\": \"http://fonts.openmaptiles.org/{fontstack}/{range}.pbf\",\n```\n\nIn either case, you must make sure that the font you specify is available from that provider.\nSee `tests/fixtures/example-style-geojson-label.json` for an example of adding labels based on coordinates specified in\nGeoJSON.\n\n### NodeJS API:\n\nThe following examples assume that you are using `babel` to provide ES6 features.\n\n```\nimport render from 'mbgl-renderer'\n\nimport style from `tests/fixtures/example-style.json`\n// style JSON file with MapBox style.  Can also be opened and read instead of imported.\n\nconst width = 512\nconst height = 256\nconst center = [-79.86, 32.68]\nconst zoom = 10\n\nrender(style, width, height, { zoom, center })\n    .then((data) => {\n        fs.writeFileSync('test.png', data)\n    }))\n```\n\nYou can also provide `bounds` instead of `center` and `zoom`:\n\n```\nconst width = 512\nconst height = 256\nconst bounds = [-80.23, 32.678, -79.73, 32.891]\n\nrender(style, width, height, { bounds })\n    .then((data) => {\n        fs.writeFileSync('test.png', data)\n    }))\n```\n\nIf you provide `bounds` you can also provide `padding` to add\nthat many pixels to each side of the rendered image. These pixels\nare padded to the inside of the image, meaning that the resulting\nimage matches the `width` and `height` you provide, but is zoomed\nout to allow padding around the edges.\n\n```\nconst width = 512\nconst height = 256\nconst bounds = [-80.23, 32.678, -79.73, 32.891]\nconst padding = 25\n\nrender(style, width, height, { bounds, padding })\n    .then((data) => {\n        fs.writeFileSync('test.png', data)\n    }))\n```\n\n`padding` must be integers and not be greater than 1/2 of `width`\nor `height`, whichever is smaller. You can provide a negative\npadding to over-zoom the image.\n\nYou can also supply a pixel ratio for High DPI screens, typically > 1 (max of 31 has been tested):\n\n```\nconst width = 512\nconst height = 256\nconst center = [-79.86, 32.68]\nconst zoom = 10\nconst ratio = 2\n\nrender(style, width, height, { zoom, center, ratio })\n    .then((data) => {\n        fs.writeFileSync('test.png', data)\n    }))\n```\n\nYou can also provide an alternative bearing (0-360) or pitch (0-60):\n\n```\nconst width = 512\nconst height = 256\nconst center = [-79.86, 32.68]\nconst zoom = 10\nconst bearing = 90\nconst pitch = 30\n\nrender(style, width, height, { zoom, center, bearing, pitch })\n    .then((data) => {\n        fs.writeFileSync('test.png', data)\n    }))\n\n```\n\nIf your style includes a Mapbox hosted source (e.g., `\"url\": \"mapbox://mapbox.mapbox-streets-v7\"`),\nyou need to pass in your Mapbox access token as well:\n\n```\nrender(style, width, height, { bounds, token: '<your access token>' })\n    .then((data) => {\n        fs.writeFileSync('test.png', data)\n    }))\n```\n\n### Command line interface:\n\n```\n  Usage: mbgl-render <style.json> <img_filename> <width> <height> [options]\n\n  Export a Mapbox GL map to image.  You must provide either center and zoom, or bounds.\n\n  Options:\n\n    -V, --version                         output the version number\n    -c, --center <longitude,latitude>     center of map (NO SPACES)\n    -z, --zoom <n>                        Zoom level\n    -r, --ratio <n>                       Pixel ratio\n    -b, --bounds <west,south,east,north>  Bounds (NO SPACES)\n    --padding <padding>                   Number of pixels to add to the inside of each edge of the image.  Can only be used with bounds option.\n    --bearing <degrees>                   Bearing in degrees (0-360)\n    --pitch <degrees>                     Pitch in degrees (0-60)\n    -t, --tiles <mbtiles_path>            Directory containing local mbtiles files to render\n    --token <mapbox access token>         Mapbox access token (required for using Mapbox styles and sources)\n    -h, --help                            output usage information\n```\n\nTo render an image using center (NO spaces or brackets) and zoom:\n\n```\nmbgl-render tests/fixtures/example-style.json test.png 512 256 -c -79.86,32.68 -z 10\n```\n\nTo render an image using bounds (NO spaces or brackets):\n\n```\nmbgl-render tests/fixtures/example-style.json test.png 512 256 -b -80.23,32.678,-79.73,32.891\n```\n\nTo render an image using bounds and padding:\n\n```\nmbgl-render tests/fixtures/example-style.json test.png 512 256 -b -80.23,32.678,-79.73,32.891 --padding 25\n```\n\nTo use local mbtiles tilesets:\n\n```\nmbgl-render tests/fixtures/example-style-mbtiles-source-vector.json test.png 1024 1024 -z 0 -c 0,0 -t tests/fixtures\n```\n\nTo use an Mapbox hosted style (see attribution above!):\n\n```\nmbgl-render mapbox://styles/mapbox/outdoors-v10 test.png 1024 1024 -c 0,0 -z 0 --token <your mapbox token>\n```\n\nNote: support for Mapbox hosted styles is still considered experimental.\n\n### Static image server\n\nYou start this from the command line:\n\n```\n  Usage: mbgl-server [options]\n\n  Start a server to render Mapbox GL map requests to images.\n\n  Options:\n\n    -V, --version               output the version number\n    -p, --port <n>              Server port\n    -t, --tiles <mbtiles_path>  Directory containing local mbtiles files to render\n    -v, --verbose               Enable request logging\n    -h, --help                  output usage information\n```\n\nTo start this on port 8080 with local tiles in `tests/fixtures`:\n\n```\nmbgl-static-server -p 8080 -t tests/fixtures\n```\n\nYou can also start this via `npm start` but you must use the `--` spacer before passing argmuents:\n\n```\nnpm start -- --port 8080 --tiles tests/fixtures\n```\n\n#### Making requests\n\nIn your client of choice, you can make either HTTP GET or POST requests.\n\n##### GET requests:\n\n`height` and `width` are integer values\n`zoom` is a floating point value\n`ratio` is an integer value\n`center` if provided must be a `longitude,latitude` with floating point values (NO spaces or brackets)\n`bounds` if provided must be `west,south,east,north` with floating point values (NO spaces or brackets)\n`padding` if provided must be an integer value that is less than 1/2 of width or height, whichever is smaller. Can only be used with bounds.\n`bearing is a floating point value (0-360)`pitch`is a floating point value (0-60)`token` if provided must a string\n\nYour style JSON needs to be URL encoded:\n\n```\nhttp://localhost:8080/render?height=1024&width=1024&center=-80,-20&zoom=3&style=%7B%22version%22%3A8%2C%22sources%22%3A%7B%22land%22%3A%7B%22type%22%3A%22vector%22%2C%22url%22%3A%22mbtiles%3A%2F%2Fland%22%2C%22tileSize%22%3A256%7D%7D%2C%22layers%22%3A%5B%7B%22id%22%3A%22land%22%2C%22type%22%3A%22fill%22%2C%22source%22%3A%22land%22%2C%22source-layer%22%3A%22land%22%2C%22paint%22%3A%7B%22fill-color%22%3A%22%23AAAAAA%22%2C%22fill-opacity%22%3A1%7D%7D%5D%7D\n```\n\nIf your style JSON points to local tilesets, you must have started the server up using those local tilesets.\n\nTo test the server from the command line, for example with the excellent tool [`httpie`](https://httpie.org/) with the style file `tests/fixtures/example-style-mbtiles-source.json`:\n\n```\nhttp :8080/render width=400 height=400 zoom=0 center=0,0 style:=@tests/fixtures/example-style.json > /tmp/test.png\n```\n\n##### POST requests:\n\nYou can do a POST request with all of the above parameters in the body of the request, and the style can be passed directly as JSON instead of URL encoded.\n\nPOST may be necessary where your style JSON file exceeds the maximum number of characters allowed in a GET request URL.\n\n## Development\n\nUse `npm run watch` to start up a file watcher to recompile ES6 files in `src/` to ES5 files that are executable in Node in `dist/`. These are compiled using `babel`.\n\n## Testing\n\nTests are run using `jest`. Right now, our coverage is not great and tests only exercise the core functionality of the render function.\n\nTests require a valid Mapbox API token. Set this in `.env.test` file in the root of the repository:\n\n```\nMAPBOX_API_TOKEN=<your token>\n```\n\nTo run tests:\n\n```\nnpm run test\n```\n\nThis uses the `pixelmatch` package to determine if output images match those that are expected. This may fail when rendered on different machines for reasons we have not completely sorted out, so don't necessarily be alarmed that tests are failing for you - check the outputs.\n\n## Docker\n\nPull the latest image from [Docker Hub](https://hub.docker.com/r/consbio/mbgl-renderer):\n\n```\ndocker pull consbio/mbgl-renderer:latest\n```\n\nTo run `mbgl-server` in the docker container on port 8080:\n\n```\ndocker run --rm -p 8080:80 consbio/mbgl-renderer\n```\n\nMount your local tiles directory to `/app/tiles` in the container to use these in the server or CLI:\n\n```\ndocker run --rm -p 8080:80 -v $(pwd)/tests/fixtures:/app/tiles consbio/mbgl-renderer\n```\n\n### Build your own image:\n\nBuild your own docker container with name `<image_name>`:\n\n```\ndocker build -t <image_name> -f docker/Dockerfile .\n```\n\n## Headless servers\n\nIn order to use this package on a headless server, you need to use `xvfb`. See `docker/Dockerfile` and `docker/entrypoint.sh` for the basic configuration.\n\n## Changes\n\n### NEXT\n\n-   avoid nesting error messages\n\n### 0.7.2\n\n-   skip request logging for routes that do not exist (e.g., docker health check)\n\n### 0.7.1\n\n-   Fixed handling of `NaN` and `Infinity` in inputs for `bounds` and `center` (#58)\n\n### 0.7.0\n\n-   Added support for padding image bounds\n-   Handle missing remote assets correctly (#49)\n-   Added support for image sources (#52)\n-   Added request logging (#54)\n\n### 0.6.2\n\n-   Fix bad handling of root path (#43)\n\n### 0.6.1\n\n-   Docker: fix missing `/app/tiles` directory if user does not bind in a tiles directory (resolves #40)\n\n### 0.6.0\n\n-   upgraded `mapbox-gl-native` to 5.0.0 (#35). NOTE: [fallback to source builds of `mapbox-gl-native` are no longer supported](https://github.com/mapbox/mapbox-gl-native/blob/master/platform/node/CHANGELOG.md#500).\n-   warn rather than fail on missing tiles\n\n### O.5.0\n\n-   upgraded Docker to NodeJS 10\n-   reduced size of Docker image and simplified Xvfb management\n-   added support for `pitch` and `bearing` options during rendering (#31)\n\n### 0.4.0\n\n-   rendering now uses floating point zoom levels when `bounds` are provided as inputs\n-   downgraded supported version of Node to 8, due to occasional segfaults: https://github.com/mapbox/mapbox-gl-native/issues/12252\n\nPrior to `0.3.1`, there was a significant bug in rendering layers with transparency (#25).\n\n## Credits\n\nThis project was made possible based on support from the South Atlantic Landscape Conservation Cooperative (http://www.southatlanticlcc.org/) and the Paulson Institute (http://www.paulsoninstitute.org/).\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<table>\n  <tr>\n    <td align=\"center\"><a href=\"https://astutespruce.com\"><img src=\"https://avatars2.githubusercontent.com/u/3375604?v=4\" width=\"100px;\" alt=\"Brendan Ward\"/><br /><sub><b>Brendan Ward</b></sub></a><br /><a href=\"https://github.com/consbio/mbgl-renderer/commits?author=brendan-ward\" title=\"Code\">💻</a> <a href=\"https://github.com/consbio/mbgl-renderer/commits?author=brendan-ward\" title=\"Documentation\">📖</a> <a href=\"https://github.com/consbio/mbgl-renderer/issues?q=author%3Abrendan-ward\" title=\"Bug reports\">🐛</a> <a href=\"#blog-brendan-ward\" title=\"Blogposts\">📝</a> <a href=\"https://github.com/consbio/mbgl-renderer/pulls?q=is%3Apr+reviewed-by%3Abrendan-ward\" title=\"Reviewed Pull Requests\">👀</a> <a href=\"#ideas-brendan-ward\" title=\"Ideas, Planning, & Feedback\">🤔</a></td>\n    <td align=\"center\"><a href=\"https://github.com/nikmolnar\"><img src=\"https://avatars1.githubusercontent.com/u/2422416?v=4\" width=\"100px;\" alt=\"Nik Molnar\"/><br /><sub><b>Nik Molnar</b></sub></a><br /><a href=\"https://github.com/consbio/mbgl-renderer/commits?author=nikmolnar\" title=\"Code\">💻</a> <a href=\"https://github.com/consbio/mbgl-renderer/issues?q=author%3Anikmolnar\" title=\"Bug reports\">🐛</a> <a href=\"#ideas-nikmolnar\" title=\"Ideas, Planning, & Feedback\">🤔</a></td>\n    <td align=\"center\"><a href=\"https://github.com/ka7eh\"><img src=\"https://avatars1.githubusercontent.com/u/4112646?v=4\" width=\"100px;\" alt=\"Kaveh\"/><br /><sub><b>Kaveh</b></sub></a><br /><a href=\"https://github.com/consbio/mbgl-renderer/issues?q=author%3Aka7eh\" title=\"Bug reports\">🐛</a> <a href=\"#ideas-ka7eh\" title=\"Ideas, Planning, & Feedback\">🤔</a></td>\n    <td align=\"center\"><a href=\"https://github.com/bertrandmd\"><img src=\"https://avatars0.githubusercontent.com/u/9257198?v=4\" width=\"100px;\" alt=\"bertrandmd\"/><br /><sub><b>bertrandmd</b></sub></a><br /><a href=\"https://github.com/consbio/mbgl-renderer/commits?author=bertrandmd\" title=\"Code\">💻</a></td>\n    <td align=\"center\"><a href=\"https://github.com/korpd\"><img src=\"https://avatars1.githubusercontent.com/u/44464673?v=4\" width=\"100px;\" alt=\"Daniel Korp\"/><br /><sub><b>Daniel Korp</b></sub></a><br /><a href=\"https://github.com/consbio/mbgl-renderer/commits?author=korpd\" title=\"Code\">💻</a></td>\n    <td align=\"center\"><a href=\"https://github.com/kjkurtz\"><img src=\"https://avatars2.githubusercontent.com/u/6036168?v=4\" width=\"100px;\" alt=\"Kyle Kurtz\"/><br /><sub><b>Kyle Kurtz</b></sub></a><br /><a href=\"https://github.com/consbio/mbgl-renderer/commits?author=kjkurtz\" title=\"Code\">💻</a></td>\n    <td align=\"center\"><a href=\"http://normanrz.com/\"><img src=\"https://avatars1.githubusercontent.com/u/335438?v=4\" width=\"100px;\" alt=\"Norman Rzepka\"/><br /><sub><b>Norman Rzepka</b></sub></a><br /><a href=\"https://github.com/consbio/mbgl-renderer/commits?author=normanrz\" title=\"Code\">💻</a></td>\n  </tr>\n  <tr>\n    <td align=\"center\"><a href=\"https://github.com/submarcos\"><img src=\"https://avatars3.githubusercontent.com/u/7448208?v=4\" width=\"100px;\" alt=\"J-E Castagnede\"/><br /><sub><b>J-E Castagnede</b></sub></a><br /><a href=\"https://github.com/consbio/mbgl-renderer/issues?q=author%3Asubmarcos\" title=\"Bug reports\">🐛</a></td>\n    <td align=\"center\"><a href=\"http://itsallinthega.me/\"><img src=\"https://avatars3.githubusercontent.com/u/83251?v=4\" width=\"100px;\" alt=\"Jez Nicholson\"/><br /><sub><b>Jez Nicholson</b></sub></a><br /><a href=\"https://github.com/consbio/mbgl-renderer/issues?q=author%3Ajnicho02\" title=\"Bug reports\">🐛</a> <a href=\"#ideas-jnicho02\" title=\"Ideas, Planning, & Feedback\">🤔</a></td>\n    <td align=\"center\"><a href=\"https://github.com/bob-gray\"><img src=\"https://avatars0.githubusercontent.com/u/814812?v=4\" width=\"100px;\" alt=\"Bob Gray\"/><br /><sub><b>Bob Gray</b></sub></a><br /><a href=\"https://github.com/consbio/mbgl-renderer/issues?q=author%3Abob-gray\" title=\"Bug reports\">🐛</a></td>\n    <td align=\"center\"><a href=\"https://github.com/abraztsov\"><img src=\"https://avatars3.githubusercontent.com/u/19175580?v=4\" width=\"100px;\" alt=\"Nikita Abraztsov\"/><br /><sub><b>Nikita Abraztsov</b></sub></a><br /><a href=\"https://github.com/consbio/mbgl-renderer/issues?q=author%3Aabraztsov\" title=\"Bug reports\">🐛</a></td>\n    <td align=\"center\"><a href=\"https://github.com/LePetitTim\"><img src=\"https://avatars1.githubusercontent.com/u/26329336?v=4\" width=\"100px;\" alt=\"Timothée Monty\"/><br /><sub><b>Timothée Monty</b></sub></a><br /><a href=\"https://github.com/consbio/mbgl-renderer/issues?q=author%3ALePetitTim\" title=\"Bug reports\">🐛</a></td>\n    <td align=\"center\"><a href=\"https://stunkymonkey.de\"><img src=\"https://avatars0.githubusercontent.com/u/1315818?v=4\" width=\"100px;\" alt=\"felix\"/><br /><sub><b>felix</b></sub></a><br /><a href=\"https://github.com/consbio/mbgl-renderer/commits?author=Stunkymonkey\" title=\"Documentation\">📖</a></td>\n  </tr>\n</table>\n\n<!-- markdownlint-enable -->\n<!-- prettier-ignore-end -->\n\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n","readmeFilename":"README.md"}