GEO map gl 3d models


#1

Hello, checking the internet I found that there is a way to include 3d models in a map when using maplibre, is there a way to do this in chartfactor?, I have a dataset with a field called class, and i need to show a different 3d model for each class.


#2

Hey @sam, in fact, we recently release a feature for 3D models in the GeoMap GL visualization using Three.js, and you can review that here: https://chartfactor.com/doc/latest/visualizations/maps_gl/#3d


#3

I see, it looks pretty good, do you have an example of a 3D layer with multiple 3D models for different values?


#4

Sure, this is a layer example, just check the gltfUrl property, in this case we are using the class name in the url:

.set("layers", [
        {
            "name": "Cars 3d",
            "priority": 1,
            "type": "3d",
            "provider": "...",
            "source": "...",
            "model": {
                light: {...},
                rotation: {...},
                scale: 5,
                gltfUrl: data => {
                    const rClass = data.rows.find(r => r.name === "class_name");
                    return `http://localhost:8081/assets/gltf/${rClass.value}.gltf`;
                }
            },
            "properties": {...},
        }
    ])

And you can review the documentation here: https://chartfactor.com/doc/latest/visualizations/maps_gl/#gltfurl


#5

I see, using a callback, make sense, thanks for the example i’ll use it