This sample shows how to load 3D tiles with meshes and point cloud data on the map. It also shows you how to style meshes and point clouds with expressions, allow measurements on meshes and point clouds, add effects to your map, and drape shapes on top of meshes. The map supports both 3D and 2D projections.
Use OGC3DTilesModel
with a TileSet3DLayer
.
You can load 3D tileset data on 2D and 3D WebGLMap
maps.
Note: The elevation data has no effect in a 2D map.
The 3D ruler controller displays various measurements: distance of 3D line segments, angles between points, orthogonal distances, heights over terrain, and area surface, depending on the selected measurement mode. To start a measurement tool, turn on the 3D ruler controller and click on the map in order to add new points for measurement. Each additional click adds a new segment to measure. You can change the measurement mode on the measurement panel.
The 3D ruler uses Map.getViewToMapTransformation
API with LocationMode.CLOSEST_SURFACE
mode. This transformation object provides for the given view position a map point on the closest surface, that is a 3D object represented by meshes, point cloud points, extrudes shapes, or terrain.
This transformation is used on 3D maps only.
The Effects and Lights tools show various graphic effects that can be applied on a 3D scene. In the effects panel you can change the camera focus depth, you can enhance depth perception by enabling eye-dome-lighting, and you can play with the color palette of the scenery. In the light panel you can enable sunlight with shadows and atmosphere lighting, ambient occlusion and fog effects.
Expression based stylingThe TileSet3DLayer
allows to set PointCloudStyle
that defines the expression based styles for the point cloud data.
The are three types of expressions:
ExpressionFactory
to define an expression that evaluates to a color value, e.g. based on attributes in the batch table section of the PNTS data.ExpressionFactory
to define an expression that evaluates to a boolean value.ExpressionFactory
to define an expression that evaluates to a number value, that is interpreted as scale factor. The scale factor of value 1 preserves the original size, a value greater than 1 enlarges points, and a value lesser than 1 makes points smaller.The TileSet3DLayer
that contains the 3D tiles with meshes is marked as a drape target using the isDrapeTarget
constructor parameter. This means that data can now be draped on this layer. To drape the walking tour shape, it is styled with a ShapeStyle
in which the drapeTarget
parameter is set to DrapeTarget.MESH
.
The Marseille 3D mesh data used in this sample was created by Airbus with Airbus Street Factory. The train station lidar data was created by Flying-Cam for Altametris and SNCF Réseau. Both datasets are available as OGC 3D Tiles services, hosted by our LuciadFusion server on https://sampleservices.luciad.com/
. You can use these services only for simple tests and demonstrations. You should not rely on either of them in any way.