mapbox / mapbox/abaculus

Basic example?

Open
#11 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
128
Forks
33
PR merge metrics
No merged PRs in 30d

Description

Hi,

I'm trying to use Abaculus to generate a hi-res image. However, I haven't got the hang of the _getTile_ function.

Could you give a simple example that, say, uses tiles from _examples.map-zr0njcqy_ (from the developer docs: _http://api.tiles.mapbox.com/v4/examples.map-zr0njcqy/0/0/0.png?access_token=pk.eyJ1Ijoid3JpZ2dsZXIiLCJhIjoiOXBUMjFERSJ9.jo2f0W7fTzbX-7lj_8pk7g_) and saves an image to the local disk?

This is as far as I got, and the getTile function (at least) is clearly incorrect.

```
// Calculate image bounds from center lng,lat coordinates and
// pixel dimensions of final image (will be multipled by scale).
var params = {
zoom: 4,
scale: 4,
center: {
x: 20,
y: -10,
w: 100,
h: 100
},
//format: {format},
//quality: {quality},
getTile: function(z,x,y, callback){
// do something
return 'http://api.tiles.mapbox.com/v4/examples.map-zr0njcqy/' + z + '/' + x + '/' + y + '.png?access_token=pk.eyJ1Ijoid3JpZ2dsZXIiLCJhIjoiOXBUMjFERSJ9.jo2f0W7fTzbX-7lj_8pk7g';
//return callback(null, buffer, headers);
},
//limit: {limit}
};

abaculus(params, function(err, image){
if (err) return err;
console.log('File saved.');
// do something with image
});
```

I know that the Static Maps API exists, but this does not allow images large enough for my purposes.

Many thanks,

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the getTile entry point in the issue and the developer documentation it references, then inspect how the abaculus callback returns the generated image. Add a simple example using the supplied Mapbox tile URL that saves the resulting image locally; done means a newcomer can run the example successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
Half a day
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.