vector-tile-js v4 proposal
@mourner 已经在做这个了。
开始于 2022年1月4日。
评估
这个 Issue 还没有评估数据。
描述
This is a proposal for a breaking overhaul of vector-tile-js that will simplify the API, significantly improve performance, and streamline interoperability between related libraries. Previously: https://github.com/mapbox/mapbox-gl-js/issues/10501
Vector Tile JS spec
There will be a specified format for representing vector tiles as pure JSON. Both the output of vector-tile-js and all related libraries (e.g. geojson-vt, supercluster) and the input for encoding (currently done by vt-pbf) will follow this format, now shared across the ecosystem.
This will ensure consistency and easy interoperability between vector-tile-js, geojson-vt, supercluster and mapbox-gl-js for both reading and writing vector data and avoid redundant wrappers and conversions between formats, improving performance and memory footprint.
JSON objects will replace the current hierarchy of classes (VectorTile, VectorTileLayer, VectorTileFeature). In particular, feature.loadGeometry() method will be replaced with feature.geometry property, making potential lazy decoding of features an internal implementation detail (e.g. using JS getters).
Flat geometry encoding
Instead of a special Point class to represent points in features, vector-tile-js and related libraries will use flat arrays of numbers ([x, y, x, y, ...]). This will minimize memory footprint when dealing with vector data, avoiding excessive array allocations in JS.
This is the most disruptive change, requiring an overhaul of all downstream code that processes vector tile geometry (specifically, bucket code in mapbox-gl-js), but with a potentially huge performance benefit.
Consistent geometry nesting
Instead of representing any type of geometry as an array of arrays of points, Vector Tile JS will use different nesting depending on type:
Array<number>for pointsArray<Array<number>>for linesArray<Array<Array<number>>>for polygons
This will allow us to include polygon nesting information in the output, avoiding ring classification in donwstream code to simplify polygon processing and reduce redundant conversions. It will also reduce redundant array wrapping for point features.
We could also go futher and collapse the outer wrapping array for single-line and single-polygon features, further improving memory footprint at the expense of more involved handling code downstream, but first we need to test whether this overhead is significant in practice.
Vector Tile encoding
After we unify the API for representing vector tiles in JS, vt-pbf will no longer feel right as a separate library — we can merge it’s functionality into this one, which will do both encoding and decoding.
Other breaking changes
feature.toGeoJSON(x, y, z)will likely becometoGeoJSON(feature, x, y, z)— this will make it usable for other producers of vector tile data likegeojson-vtandsupercluster, and fit the new paradigm of features being accessed as JSON objects.- Should we remove
feature.extent? It’s a layer property which is currently also duplicated for every feature for unclear reasons. - Should we remove
feature.bbox()? It doesn’t appear to be used anywhere downstream, and there’s not much overhead to iterating overgeometryto get a bbox instead.
cc @mapbox/gl-js @kkaefer
- 主要语言
- JavaScript
- 星标
- 405
- 派生
- 91
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
mapbox/vector-tile-js 的其他 Issue
-
enhancement
难度 4/5 3-5 天 新手友好度 45/100
mapbox/vector-tile-js#81 · 1 条评论 ·
-
enhancement
难度 4/5 3-5 天 新手友好度 35/100
mapbox/vector-tile-js#59 · 3 个 reaction ·
-
Layer toGeoJSON未关闭enhancement
难度 2/5 1-3 小时 新手友好度 52/100
mapbox/vector-tile-js#38 · 7 个 reaction ·
-
enhancement
难度 5/5 一周以上 新手友好度 25/100
mapbox/vector-tile-js#25 · 5 条评论 ·
-
question
难度 4/5 3-5 天 新手友好度 35/100
mapbox/vector-tile-js#18 · 2 条评论 ·
查看 mapbox/vector-tile-js 的全部 Issue
相似的 Issue
-
docs hacktoberfest help wanted
难度 2/5 1-3 小时 新手友好度 85/100
pacocartones/free-llm-api-hub#347 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
cytoscape/cytoscape.js#3536 ·
维护者通常 15 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
cuttle-cards/cuttle#1440 ·
维护者通常 1 天内回复
-
URL-encoded parser builds nested objects nothing reads可能已有人在做 @Senthil455 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 82/100
Janani-bn/CivicFix#168 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
code-yeongyu/oh-my-openagent#10172 ·
维护者通常 1 天内回复