# Color Point Cloud based on elevation

**URL:** <https://community.cesium.com/t/color-point-cloud-based-on-elevation/30103>\
**Category:** CesiumJS\
**Created:** [February 23, 2024, 2:38am UTC](https://community.cesium.com/t/color-point-cloud-based-on-elevation/30103 "2024-02-23T02:38:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ethyl\_smith](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/ethyl_smith/32/3476_2.png) [@ethyl\_smith](https://community.cesium.com/u/ethyl_smith)\
**Post date:** [February 23, 2024, 2:38am UTC](https://community.cesium.com/t/color-point-cloud-based-on-elevation/30103/1 "2024-02-23T02:38:45Z")

</div>

I’m trying to style the point cloud based on elevation. I’m guessing the elevation can be represented by the per point attribute ${POSITION}[2]?

When I do this, it does change the color of most points under 60, but it also color some points above 60 (e.g. top of buildings). Maybe I’m missing something here?

 ![2024-02-23_10-38](https://global.discourse-cdn.com/cesium/original/3X/7/2/722b6483145069ca8e4c5fd510fced12a22c60e5.jpeg)

```auto
pointCloudTileset.style = new Cesium.Cesium3DTileStyle({
  color: {
    conditions: [
      ["${POSITION}[2] < 60", "color('#7A0403')"],
      ["true", "color('#FFFFFF', 1.0)"],
    ]
  },
});

```

Here’s the [sandcastle](https://sandcastle.cesium.com/#c=jVVrb+I4FP0rFrtSg8Qa5wl0abUMbTVoO213YXY+lKoyiSnWOnZkO3SZUee373USmDDtPoKU2Pd57vH1ZUs12nL2zDQ6Q5I9oykzvMzxH5XMW3bSaj9V0lIumV52eujLUiJkmdYgOd07LOo9XmuVf1JaZI3A6/acOZU8p5YrcFhTYVglXFHDrumO6Tue/sn0m6pvwpfuz0u5lDVabFImGX4SasWwM54qoVwNDZxqi99dT6a/Vl79Ppqgrz5BKy4EwECF4tKi8AItuGCGWaTWyG4YSrndufUHqFgzKnpoSiXNKEppYUvNMsQlCogfo2duN4gizYwSpSvNuQUEpTmugmZQdIY2ylhYrnYNMgSGGKoA3isIU6HKbI/hDNFnyu2hiOoTXjTqituZkhMDm1nmBcNRFDfHgVrR5huacfl0utcA+9YyWTb8W13WHLsnp3/xvMwnbYOg0b7sST+ivNA855ZvmcE0y7xXRXT3fF+JHbKqIvUdV6bYMM3Qh9KwMj+ETGnONMXg5hrOqwBnzFguGyytlpxSbWFFZejV+PwgGRBCcESiaJiE8WjYAP8pCkYxiRNMhklE4oDsFVEcVB7DEB6SJCMnrhtUac6gx+usDXEZ1yz9bxyQkOBBFEBKEhKfDIZh0GupwsgPAxIlZOBHoyAI27p4AMATQAOlhFHk16puY1IW/yMzRI5jnwRhCK/ByB+04wMUkkThIE6GhITD6KCD1EBGEARR4IdAih+2U79Ub0YN9NFVKRsSGhiXR2L828fJxe+TxWz6OLt5vP24+HZVX/UGNnYn2PGkaTf53KnrLkjdBT6cRKpkxl02c4ru9yXcLzs/frm7nc8Ws9ubl/vgAY1RQtyEgrHl3L2THwYTEpHwpLvsPPRafu4OHBteVc9JD/mYtKwf9mw0JQEQY9EGbrb4fmTOU82YnBc0ZZdb6KX3tZF3aHW49KaO0vi7vp/JorSTiklv3VDq5WrLcgjRRQ0XEmYMw0I9HVS4UKZixEWsTSxaM+pmFOA6vrIwXu8a838LsM/RhHGKl94/lbfYFQxfX14tHi9uP93Udblfp9cZV8d8vuf7F54XSltUauFh3LcsLwSFRu6vShj7FqfG1BgQGvfbruOMbxHPzt74F0KpoMaAZl0KMeef4TTPx32wf+UqVDUNb7dMC7pzZhv//LoWYozHfdi+7WmVEiuqv4v8Nw) that I’m currently working on

---

<div class="post-metadata">

**Author:** ![anneg](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/anneg/32/11217_2.png) [@anneg](https://community.cesium.com/u/anneg)\
**Post date:** [February 23, 2024, 9:12am UTC](https://community.cesium.com/t/color-point-cloud-based-on-elevation/30103/2 "2024-02-23T09:12:39Z")

</div>

`POSITION` is in model coordinates.

You could use `POSITION_ABSOLUTE`, which is in world coordinates, and calculate the distance to the ground per point. Keep in mind that `POSITION_ABSOLUTE` might suffer from precision loss.
