# Polygon Entity extruded height performance

**URL:** <https://community.cesium.com/t/polygon-entity-extruded-height-performance/26682>\
**Category:** CesiumJS\
**Created:** [September 11, 2023, 5:45pm UTC](https://community.cesium.com/t/polygon-entity-extruded-height-performance/26682 "2023-09-11T17:45:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tristan.holbrook](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/tristan.holbrook/32/14000_2.png) [@tristan.holbrook](https://community.cesium.com/u/tristan.holbrook)\
**Post date:** [September 11, 2023, 5:45pm UTC](https://community.cesium.com/t/polygon-entity-extruded-height-performance/26682/1 "2023-09-11T17:45:02Z")

</div>

I am trying to show aggregate metrics using H3 polygons and a combination of color and extruded height over time. I am experiencing a large performance drop using a SampledProperty with the extrudedHeight of the polygon.

Here is an example with the extruded height:

> **[Cesium Sandcastle](https://sandcastle.cesium.com/#c=nVb7b+I4EP5XLLQnBS1nSh9sl9LqqtBHUKEPaHfb43Q1yZS4ODFrO7S04n8/5wVJgG51+QUy8803D8+MY4KkgYct7mMHnkjA1LFtg5R9PgYfHaJBCWZtd3hm00vatm7frFqXWtLyb/Zs06pb48nPO7P9HWvQL+dsHIJY5+1256F1+nxp1rxO6373on/jdrdP1P2Pk9cu1bLtu+fOs127bD2Mu/1bemG2Jw+arPN2vddt3UvLY64TvvfvXzr9451Ov7PbOd/CNef7r3r9etxlrN11776xm/afvZ97o63rjtnnz3f0jNdPT897Qfd2UDoY+APf5r5UaErhBYTOxYcXZMb53kUyY1Cyo3eT+4pQH8SgVNaWsQWWNvigyzIMRj2Xv5wK4oG8AtEDTexoQiUCiBwpMUPvAx+h2KMAyQNhg4aQF0JV6lVX+SZR4SfBvWMpQVmOsb29962+Xw9dI7SksQOpuNciivRSukwKZkGrk5HEmzCIc0Ar5hh8RRUFiWUgJ+A7J1MtkUaCjlw6C7TJuD3Oe2zllUYxXp227h9t0+5ddvGECAlGnL9YZA3Kdo3y0iVngBkf6eBvUus/+KBUSchWgY9SEaH61AP05T0G4YVo/rjGQGeahyeCLFihBUe7pWNIMm4HjBJf5x2flyX5fn2rZhTdxjyF2mE7EEIXOPJ9mOVfi16m9RksnyTQTwWaJFyOejUkfOLCYKAQPdyqIKZpEmDoCDPwR8o9QBQ1EdM/X7+ictTc4RMXy90xgRXs/qb/HMTsSxyZEsrIkDKqZpavQEwJWwYdxpRKTc4Y2IrqPZRNYOE3fGgsbKDHL++ZEmHFe0pQf2SU59Uv75uKlYU9prTz8krMLtCRq64En4BQs/wE9KIBc1Kl0Q28IYj4+MMnb4uJ48QW8orYY3COhSAzIy4ejrGV7GEviZIFwAP/f0aSM/04kAgqfxMI4+JzgaTbKbTI0mQIfheOhq6GkzKFbWtzLhy5bCRTI/U/4u9EzdOCkQCQOdYRcK+S4k8YoxPJqYN/nPX2d4vZRnsyTHPzBtUZFHrTaaD0YHf+pc5rJav19c3xkT47J421U5ODTzibjbjfQLkQogakIIiw3dkaXWwpaThkspEUsQiaV4oSeNXXnAPOedSvjUKPr8DdBFZb0Xh6OwlKWCN3i4Wn3Uk0iybKtUs5SzTPTW7yvvmcwv3kQe6iSy735ZqIT7PIkQPbaxb6B+t+1TS73Tdu/nVmi0W/aa2tGIWfNh3uAMNy5tuu4D59g3zuStsx/bmDg4mmhVM9M9kbvYh649zrc2Nj3JWNwYV8c2QTfekjA4TQK2H5nZRe0LE8RJYqpaZUMwZH6Sn/Rb0JFwoFghkYVxXoraEjltVhoBeHwraU6fQ2q1nTpkOneigP13zhIZsRKbXmKWCsp4szKB01qxq/Yso4cfSFcTkFwcgshLm1o4tYiDFuVvXrekvFORsSUWD+Dw)**
>
> The Cesium Sandcastle provides an interactive environment for testing Cesium code.

I originally was generating CZML to do this and then tried just creating the entities myself, though it didn’t make a difference.

I have another example without it and just the interpolated color and the performance is fine. I am wondering what I can do to improve the performance. Would using the geometry and appearance APIs and creating/removing the primitives myself be more performant? It seems like it spends a lot of time in the main thread updating the PrimitiveCollection, so I am not sure if that would even make a difference.

Is what I am trying to do even reasonably feasible for CesiumJS?

---

<div class="post-metadata">

**Author:** ![Gabby\_Getz](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/gabby_getz/32/7838_2.png) [@Gabby\_Getz](https://community.cesium.com/u/Gabby_Getz)\
**Post date:** [September 12, 2023, 5:42pm UTC](https://community.cesium.com/t/polygon-entity-extruded-height-performance/26682/2 "2023-09-12T17:42:58Z")

</div>

Hi there,

So when changing to extruded height of a polygon, there is some recompilation that needs to be done under the hood to create vertex data and send it to the GPU.

Using the underlying primitive API will give you more control, but will have more code overhead.

Also, the performance I’m seeing here is definitely not what’d I’d expect.

Do you mind explaining the data you’re loading via CZML?

---

<div class="post-metadata">

**Author:** ![tristan.holbrook](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/tristan.holbrook/32/14000_2.png) [@tristan.holbrook](https://community.cesium.com/u/tristan.holbrook)\
**Post date:** [September 12, 2023, 8:37pm UTC](https://community.cesium.com/t/polygon-entity-extruded-height-performance/26682/3 "2023-09-12T20:37:21Z")

</div>

Here is an example of the CZML per polygon I was generating:

```auto
{
  "id": "832688fffffffff",
  "name": "832688fffffffff",
  "description": "Metric in H3 Cell: 832688fffffffff",
  "polygon": {
    "positions": {
      "cartographicDegrees": [-104.33169514214511,37.61299079256905,-103.85102976556078,38.135049165836236,-104.20599904013339,38.72118935402389,-105.04826666914855,38.784053392458446,-105.52685292295116,38.25975663382743,-105.16538034685188,37.674847673581894,-104.33169514214511,37.61299079256905]
    },
    "material": {
      "solidColor": {
        "color": {
          "epoch": "2023-09-01T00:00:00Z",
          "rgba": [0,0.8173,0.3451,0.047,1,1800,0.298,0,0.2078,0,3600,0.9566,0.6292,0,1,...]
        }
      }
    },
    "extrudedHeight": {
      "epoch": "2023-09-01T00:00:00Z",
      "number": [0,100000,1800,0,3600,600000,5400,800000,...]
    }
  }
}

```

The extrudedHeight and color would just be extended out further, every 30 minutes for the rest a 24 hour period.

Each H3 polygon shows an aggregate metric on a 30 minute interval. I’d like to be able to interpolate between the values to show it smoothly animate over time.

I’m running this on an M1 MacBook Pro, if that makes any difference.

Any help is appreciated. Thank you!
