MapInfo Pro

 View Only

MapInfo Monday: Adding a 3D Shape to a 3D Map

  • 1.  MapInfo Monday: Adding a 3D Shape to a 3D Map

    Employee
    Posted 05-20-2024 02:00
    Edited by Peter Møller 05-21-2024 02:44

    Happy #MapInfoMonday!

    In today's article, we will dive into a specific 3D Layer and show how to use this in a 3D map. We will look at the 3D Shape layer.

    A 3D Shape layer allows you to place a 3D Shape at the location of a point dataset. This could be trees, streetlights, and other elements you want to include in your 3D map to provide more detail.

    We are using Deck.gl as our 3D rendering engine and when you look at Deck.gl, they refer to this layer as a SimpleMeshLayer. You can find more details about this layer type in the Deck.gl documentation.

    I have - like any decent TV chef - already done the basic work. So I have a 3D map open in MapInfo Pro.

    The next step is to add a 3D Shape layer for my tree point layer.
    From the 3D tab, I click on 3D Shapes from the Layers dropdown.
    The Add 3D Shapes Layer dialog prompts me to select a Layer and to select a 3D Shape model file as well.
    I can click the Browse button next to the Uri: field and browse to the location of my 3D Model file. This file must be in the GLB format (GL Transmission Format Binary file). This is a standardized 3D format called glTF. The GLB is a packaged binary file. You can find various websites where you can download free 3D Models or buy some for a small amount. 
    Once I have selected the layer to use and the 3D Shapes file to place at each point, I can click the OK button to add it to my 3D map.
    Often you can see the 3D Shapes being rendered but then they disappear again. As you can see below, the layer is in the 3D Layers list but the trees aren't visible in my 3D map.
    The first thing you should try is to Enable the Auto option, which will automatically apply layer and layer setting changes. Then click on the Apply button to apply any changes.
    If the 3D Shapes still don't show, it is often fixed by changing two parameters on the 3D Shape layer. Notice how the layer is named using the name of the table and the name of the 3D Model file. In my example, the layer is called Trees trees.
    Try changing these two parameters:
    • Under Height, switch to Relative to Terrain.
    • For Orientation, change the last 0 to 90.
    Once your 3D Shapes appear, you may want to apply different sizes to the shapes. By default, the Shape Scale is set to 1 in the three dimensions, X, Y, and Z. If you use at least MapInfo Pro v2023 build 142, you can scale the 3D shapes individually using a value in a column.
    Click on the two dots to the right of the Shape Scale field. This will bring up the Java Script Expression Editor dialog. In this dialog, you can insert fields from your table into the expression. In the example below, I have deleted the value 1 and replaced it with a column name by double-clicking on the column name in the Columns list. The value will be inserted where your cursor currently is located. You can also write directly into the Shape Scale: field to modify the expression.
    I have chosen to replace all 3 scales with a value read from a field multiplied by two. You could also scale only one of the directions by a field and keep the other directions hardcode to a fixed value.
    This results in this 3D map.
    I hope this gave you some ideas on enriching your 3D map in MapInfo Pro with 3D shapes.



    ------------------------------
    Peter Horsbøll Møller
    Principal Presales Consultant | Distinguished Engineer
    Precisely | Trust in Data
    ------------------------------