Basic example?
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 半天
- 新手友好度
- 35/100
- Issue 类型
- 文档
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- javascript
调研方向
从 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
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
mapbox/abaculus 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 35/100
-
Place markers未关闭
难度 5/5 一周以上 新手友好度 25/100
-
难度 3/5 1-2 天 新手友好度 30/100
-
难度 4/5 3-5 天 新手友好度 25/100
-
难度 2/5 1-3 小时 新手友好度 45/100
相似的 Issue
-
bug CI breakage triage needed
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
draftomen enhancement size: S
难度 2/5 1-3 小时 新手友好度 75/100
andreagrandi/draftomen#761 ·
-
难度 1/5 1 小时以内 新手友好度 92/100
HarperFast/harper#2866 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
HarperFast/harper-pro#927 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
anthropics/skills#1897 · 1 条评论 ·
维护者通常 1 天内回复