mapbox - 将 3D 模型导入 Mapbox

标签 mapbox mapbox-gl-js

我看到一篇“向 Mapbox GL JS map 添加 3D 模型”的帖子。如果我有从 Autodesk Revit 导出的 GLTF 模型,如何通过给定的地理坐标 (wgs84) 将 3D 模型准确放置在 map 上?

最佳答案

您探索过threebox的最新版本吗? ??它使您能够通过 CustomLayerInterface 使用 Mapbox 对 3D 对象的支持,在 Mapbox 之上添加任意数量的模型和 3D 图层,只需几行代码

    map.on('style.load', function () {
        map.addLayer({
            id: 'custom_layer',
            type: 'custom',
            renderingMode: '3d',
            onAdd: function (map, mbxContext) {

                window.tb = new Threebox(
                    map,
                    mbxContext,
                    { defaultLights: true }
                );

                var options = {
                    obj: '/3D/soldier/soldier.glb',
                    type: 'gltf',
                    scale: 1,
                    units: 'meters',
                    rotation: { x: 90, y: 0, z: 0 } //default rotation
                }

                tb.loadObj(options, function (model) {
                    soldier = model.setCoords(origin);
                    tb.add(soldier);
                })

            },
            render: function (gl, matrix) {
                tb.update();
            }
        });
    })

你还可以做更多... - 3D 模型内置和自定义动画

3D models built-in and custom animations

- 完全光线转换支持 MouseOver/Mouseout、选定、拖放、拖放、旋转、线框

MouseOver/Mouseout, Selected, Drag&Drop, Drag&Rotate, Wireframe

- 考虑海拔高度的 CSS2D 工具提示和标签

CSS2D Tooltips and Labels that consider altitude

- 三个.js 和 Mapbox 相机与深度调整同步

Three.js and Mapbox cameras sync with depth adjustment

- 包括具有阳光和阴影内置支持的纪念碑地理定位模型

Eiffel tower gif

- 优化加载数千个 3D 对象

Performance

关于mapbox - 将 3D 模型导入 Mapbox,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65439048/

相关文章:

ios - 打开自定义属性以更改 MGLSymbolStyleLayer 的图像

javascript - MapboxGL 根据从文件加载的数据的属性设置可见性

android - 加载自定义 .mbtiles 文件时出现 "No data"错误

mapbox-gl-js - 使用 Mapbox GL JS 删除过滤器

mapbox-gl - MapBox GL JS性能差异的原因

javascript - 加载时的 Mapbox queryRenderedFeatures

php - 从 MySql 在 php 中创建 GeoJson 以与 MapBox javascript API 一起使用

ios - MapBox GL 从 makefile 构建 Xcode 项目

javascript - 如何获取用户当前位置?

javascript - 高性能 GL 三 Angular 形 Mapbox GL JS