Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Basic example?

未关闭
#11 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
半天
新手友好度
35/100
Issue 类型
文档
描述清晰度
基本清楚
活跃度
停滞
技术栈
javascript
领域
documentation

调研方向

从 issue 中的 getTile 入口点以及它所引用的开发者文档开始,然后检查 abaculus 回调如何返回生成的图像。添加一个使用所提供的 Mapbox 瓦片 URL 并将生成的图像保存到本地的简单示例;当新手能够成功运行该示例时即表示完成。

由索引模型根据 Issue 内容生成。

描述

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,

主要语言
JavaScript
星标
128
派生
33
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

mapbox/abaculus 的其他 Issue

查看 mapbox/abaculus 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。