PointCloudLayer - toggle renderers
Point cloud data can be visualized in the browser using the PointCloudLayer. The visualization of each point (its color and size) is defined by a renderer. There are four renderer types that may be applied to point cloud data:
- PointCloudRGBRenderer
- PointCloudUniqueValueRenderer
- PointCloudStretchRenderer
- PointCloudClassBreaksRenderer
These renderers can be created manually using the API defined in the documentation, or generated using the Smart Mapping APIs. There are three renderer creator methods that simplify the renderer creation process for PointCloudLayer:
- colorRendererCreator.createPCTrueColorRenderer() - Generates a renderer that visualizes points with the original scan color
- typeRendererCreator.createPCClassRenderer() - Generates a renderer that visualizes each point based on unique values, such as classification codes (e.g.
high vegetation
,water
, etc.) - colorRendererCreator.createPCContinuousRenderer() - Generates a renderer that visualizes each point along a continuous color ramp (e.g.
intensity
orelevation
)
This sample shows how to call each of these methods and apply different renderers to the PointCloudLayer. The renderer used for the visualization depends on a given field name. Typical field names for point clouds include ELEVATION
, RGB
, CLASS_
, and INTENSITY
. For example, rather than map colors to a long list of class codes in a PointCloudUniqueValueRenderer, you can simply call the createPCClassRenderer() method to generate the standard colors for the data based on the CLASS_
field:
This sample uses a custom function to generate the appropriate renderer based on a given field name.
Additional resources
See the following samples to learn how to manually create the renderers listed above rather than using the Smart Mapping APIs to do so: