{"id":22354065,"url":"https://github.com/movableink/abaculus","last_synced_at":"2025-03-26T12:28:33.534Z","repository":{"id":142003912,"uuid":"54817704","full_name":"movableink/abaculus","owner":"movableink","description":null,"archived":false,"fork":false,"pushed_at":"2019-05-08T16:30:18.000Z","size":1125,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-01-31T13:43:41.918Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/movableink.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-27T07:35:35.000Z","updated_at":"2020-08-10T15:27:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"f3697638-4660-4620-85ee-0b6e992b6a67","html_url":"https://github.com/movableink/abaculus","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/movableink%2Fabaculus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/movableink%2Fabaculus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/movableink%2Fabaculus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/movableink%2Fabaculus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/movableink","download_url":"https://codeload.github.com/movableink/abaculus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245653021,"owners_count":20650617,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-04T13:11:03.938Z","updated_at":"2025-03-26T12:28:33.510Z","avatar_url":"https://github.com/movableink.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## abaculus\na small block of stone, tile, glass, or other material used in the construction of a mosaic\n\nor,\n\na library for creating static maps from tiles based on center or corner lng,lat coordinates.\nUses node-mapnik to stitch tiles together.\n\n[![Build Status](https://travis-ci.org/mapbox/abaculus.svg?branch=master)](https://travis-ci.org/mapbox/abaculus)\n\n[![Build status](https://ci.appveyor.com/api/projects/status/k5e2v42uhbda1ihx)](https://ci.appveyor.com/project/Mapbox/abaculus)\n\nLooking to create high res images of maps? Abaculus was written for use in [Mapbox Studio](http://github.com/mapbox/mapbox-studio) and you can use Mapbox Studio to create and export high resolution images -- see [https://www.mapbox.com/guides/print/](https://www.mapbox.com/guides/print/) for more information. You can even use [that utility from the command line](https://github.com/mapbox/mapbox-studio/issues/1024#issuecomment-63535433).\n\n### usage\n\nUsage and example formatting below, or see the [tests](https://github.com/mapbox/abaculus/blob/master/test/test.js#L158-L204) for a more robust example with a `getTile` function.\n\n#### input:\n`scale`: integer between 1-4 and sets resolution (`scale: 1` is 72dpi, `scale: 4`, is 288dpi)\n\n`zoom`: zoom level\n\n`[w, s, e, n]`: the bounding box for the west (lat val), south (lng val), east (lat val), north (lng val) for the desired area\n\n`x`: longitude coordinate\n\n`y`: latitude coordinate\n\n`width` and `height`: desired pixel bounds for a map with a center coordinate. Will be multiplied by scale to maintain resolution.\n\n`format` (optional): `png` or `jpeg`, default is `png`.\n\n`quality` (optional): when used with `jpeg` format, accepts 1-100 and defaults to 80. when used with `png` format, accepts 2-256 (# of colors to reduce the image to) and defaults to none.\n\n`getTile`: a function that returns a tile buffer (png or otherwise) and headers given `z`, `x`, `y`, and a callback, such as from [tilelive-vector](https://github.com/mapbox/tilelive-vector/blob/master/index.js#L119-L218) or this [test function](https://github.com/mapbox/abaculus/blob/master/test/test.js#L184-L204).\n\n`limit` (optional): max width or height of generated image in pixels. Default is `19008`.\n\n```javascript\n// Calculate image bounds from W,S,E,N bounding box.\nvar params = {\n\tzoom: {zoom},\n\tscale: {scale}\n    bbox: [{w}, {s}, {e}, {n}],\n    format: {format},\n    quality: {quality},\n    getTile: function(z,x,y, callback){\n    \t\t\t// do something\n\t\t\t    return callback(null, buffer, headers);\n\t\t\t},\n\tlimit: {limit}\n};\n```\nor\n```javascript\n// Calculate image bounds from center lng,lat coordinates and\n// pixel dimensions of final image (will be multipled by scale).\nvar params = {\n\tzoom: {zoom},\n\tscale: {scale}\n    center: {\n    \tx: {x},\n    \ty: {y},\n    \tw: {width},\n    \th: {height}\n    },\n    format: {format},\n    quality: {quality},\n    getTile: function(z,x,y, callback){\n    \t\t\t// do something\n\t\t\t    return callback(null, buffer, headers);\n\t\t\t},\n\tlimit: {limit}\n};\n```\n#### usage:\n``` javascript\nabaculus(params, function(err, image, headers){\n       if (err) return err;\n       // do something with image\n\t});\n```\n\n#### output:\nan image of desired resolution for the selected area.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmovableink%2Fabaculus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmovableink%2Fabaculus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmovableink%2Fabaculus/lists"}