Visualizing HSPC data on a map requires few steps:

  1. Decode the data into an ITileSet3DModelITileSet3DModelITileSet3DModel by using the HspcModelDecoderHspcModelDecoderHspcModelDecoder.

  2. Use a TileSet3DLayerTileSet3DLayerTileSet3DLayer to visualize the model.

  3. Optionally, adjust the layer settings to provide a better viewing experience.

Decoding and visualizing the data

Program: Decoding and visualizing HSPC data
// First create the model
auto tileSetModel = HspcModelDecoder::decode(url);

if (tileSetModel) {
  // Create a layer for the model using the layer builder
  auto tileSetLayer = TileSet3DLayer::newBuilder().model(*tileSetModel).build();

  // Add the layer to the map
  map->getLayerList()->add(std::move(tileSetLayer));
}
try
{
    // First create the model for the Hexagon Smart Point Cloud (HSPC) data
    var tileSetModel = await Task.Run(() => HspcModelDecoder.Decode(Url.Trim()));

    // Create a layer for the model using the layer builder
    var tileSetLayer = TileSet3DLayer.NewBuilder().Model(tileSetModel).Build();

    // Add the layer to the map
    Map.LayerList.Add(tileSetLayer);

}
catch (Exception e)
{
    MessageBox.Show(e.Message);
}
// First create the model
val tileSetModel = HspcModelDecoder.decode(url.trim())

// Create a layer for the model using the layer builder
val tileSetLayer =
    TileSet3DLayer.newBuilder().model(tileSetModel).build()

// Add the layer to the map
map.layerList.add(tileSetLayer)

Adjusting layer settings

Quality factor

Each dataset is configured by default to load a given number of tiles at a certain detail level. Sometimes, that default configuration doesn’t offer the best loading experience. If the dataset tries to load too many tiles, it causes longer wait times. If it loads too few tiles, the result may be low visual fidelity.

You can change the loading experience by adjusting the quality factorquality factorquality factor of the TileSet3DLayerTileSet3DLayerTileSet3DLayer. A quality factor of 1.0 loads the number of tiles set by the dataset itself. To load more tiles, set a higher quality factor. To load fewer tiles, choose a lower quality factor.

Fading time

As the camera moves, new tiles are loaded to provide more details of areas closer to the camera. The new tiles sometimes replace previously loaded tiles. It’s more visually pleasing if this change doesn’t happen instantaneously, and the previous tiles fade out while the new ones fade in. To adjust the visual transition, use the fading timefading timefading time of the TileSet3DLayerTileSet3DLayerTileSet3DLayer. By default, the fading time is 200 ms.

Mesh style

By setting the mesh style, you can choose how to style the mesh data in your layer. Using style expressions, you can set the color, displacement, and visibility of your meshes. You can also set the type of facet culling that you prefer. If the layer doesn’t have mesh data, LuciadCPillar ignores this setting.

See Styling mesh data for more information.

Point cloud style

By setting the point cloud style, you can choose how to style the point cloud data in your layer. Using style expressions, you can set the color, scale, and visibility of your points. You can also decide to scale the points according to the pixel size or the world size. If the layer doesn’t have point cloud data, LuciadCPillar ignores this setting.

See Styling and filtering point clouds for more information.