Skip to content

Basic example? #11

Description

@ikmolbo

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,

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions