# Polygons with heightReference, perPositionHeight, no extrusion

**URL:** <https://community.cesium.com/t/polygons-with-heightreference-perpositionheight-no-extrusion/7291>\
**Category:** CesiumJS\
**Created:** [August 14, 2018, 1:05am UTC](https://community.cesium.com/t/polygons-with-heightreference-perpositionheight-no-extrusion/7291 "2018-08-14T01:05:34Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jessica\_Gettings](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@Jessica\_Gettings](https://community.cesium.com/u/Jessica_Gettings)\
**Post date:** [August 14, 2018, 1:05am UTC](https://community.cesium.com/t/polygons-with-heightreference-perpositionheight-no-extrusion/7291/1 "2018-08-14T01:05:34Z")

</div>

1. A concise explanation of the problem you're experiencing.

When a polygon has perPositionHeight and is not extruded, attempting to set a heightReference (RELATIVE\_TO\_GROUND or CLAMP\_TO\_GROUND) gives the following error:

DeveloperError: Appearance/Geometry mismatch. The appearance requires vertex shader attribute input 'applyOffset', which was not computed as part of the Geometry. Use the appearance's vertexFormat property when constructing the geometry.

2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.

Here is a sandcastle that demonstrates the issue. You can double-click the map to attempt to clamp the polygon to ground:

> **[Cesium Sandcastle](https://sandcastle.cesium.com/?)**
>
> The Cesium Sandcastle provides an interactive environment for testing Cesium code.

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I was able to change the heightReference on polygons I'd created in 1.46 without a problem, and I would like to keep using the same workflows I've been using.

4. The Cesium version you're using, your operating system and browser.  
1.48  
Windows 10  
Chrome

---

<div class="post-metadata">

**Author:** ![majestic.youthscape](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@majestic.youthscape](https://community.cesium.com/u/majestic.youthscape)\
**Post date:** [August 14, 2018, 12:44pm UTC](https://community.cesium.com/t/polygons-with-heightreference-perpositionheight-no-extrusion/7291/2 "2018-08-14T12:44:20Z")

</div>

I am seeing the same issue as well. Curious to know if there is a fix in the works.

---

<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:** [August 16, 2018, 7:02pm UTC](https://community.cesium.com/t/polygons-with-heightreference-perpositionheight-no-extrusion/7291/3 "2018-08-16T19:02:39Z")

</div>

I was able to avoid the error by setting the value via a Callback Property rather than directly. Using a Callback Property will mark that property of the entity as dynamic.

See this [updated example](https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/#c=nVZrc+I2FP0rGr7ETF0B25AhIWSaEnbDlA0MIdvplA4j7IutiZBcSSZld/jve/0C4zw2rflgLN1zfO7VfXjDNPHA8Hg9A60ZlxOtNtwHTXqkn65TTwOz8IfSws9tnHp3LjeIBCF4ZBT3n4MlPBUEg1esUpqMaMPhqQr7kq45J5m8vpIWsaBPXPJtLgleS2ZgxLagJ9x7RPQFWTFhwM12bUXSxct+zuUuk9FoEB8iGyLQWMICtMF7zkK4IRr+ibkGn1hF1uwRiA2BREpsAyUN8QRbR8lWjkgJEwpgPlErYkL1xGWAIK3iICTckpVWaxJLFBHgmvQxFKnL1HgggQZCLYGmmmYo6TpTlMvHUFkdQ6o8C6FQMuA29gG3zmin3Txrtc87+Gu2P7Ty8xLMFianbdo5b5+etTvn5+ennc5ZbuKDsAz3m7TZbO3PJwQehHYKK9AgPTgkx+3xBr0b3w0yVOGKBpD3EfNgsAFpb5n0RbIOdiij2F57livpZEe2imX2WC+OOLkO/3JOpOGWg6EbJmK8rZQeMC90SpZ7ptR2i3ylzZQqcSpJuIpn3WOz5yBM0Fvdfd2Gr4gzr81r5KeUv9cj+dMbATtyt7g8zColgAoVICHGy6bpo7JMm9fq3eeYVNzrh9MfXX+eLGbjxafp+OHupluRvsN6NvCftEgl4X9JyfPk6PVvhb6s4MSqIBCJguzwsDJz2gtygpFOX13vvpcuSxGaVzKtJMTbPM/rIsuPg9WuINjlfSkPyH2lMGbbCOho8HG2uBk//DYaLPqjYf/3rDUVufeUdKbeodK7hy1gx1sYBqzg1hHcqBjbW2/fBUpwqfTR1gFeWLDDWfaZxh7JmfyFJi3sBgJ0xTiJOjd7Sb0EXL4TmEooA70fAhOnXwD67wTupR6gkTI86RsGKf5iLlm6xHOJ/3fBXmlAzPedUrnkKYSjplJDEc6onDkrhIu0e7uVZOKgmfbCLRLshVRs1jiKNWcCTQoXlVA69W6KvVWtnW9MRCFDg9au7r6drhfledtnQiyZ94iTEfXarfNyOy4uDTbW8gf9c+dmM7leKoi8HOrF7Mpi6rE1eo8FqR6vrfP28e2z3N0nrEvazWbdLftzi5MXm8SEWy/E0ARQsH5mNqSToUt+Pl5YjL8MpouP44epSz40kS79zHlB3kwzaXDqrEuMmv97Soc3g7vZcPZnvVtza5fGbgVcZe7+ytcR5imJtXAobVhYRygdTGMZ47eLpZ4xydsuGwXo0ucbwv3evFb5/sFhghPAGNxZxULc86/Yga8uG2h/BBMqdX+8AS3YNjEJW1ejbJFSetnAx+coqxQmgS4xfgc).

However in either case I can’t see the polygon, even when turning off depthTestAgainstTerrain, so let me know if that helps or not.

Thanks,

Gabby

---

<div class="post-metadata">

**Author:** ![Jessica\_Gettings](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@Jessica\_Gettings](https://community.cesium.com/u/Jessica_Gettings)\
**Post date:** [August 22, 2018, 4:48pm UTC](https://community.cesium.com/t/polygons-with-heightreference-perpositionheight-no-extrusion/7291/4 "2018-08-22T16:48:33Z")

</div>

Unfortunately I don’t think this solves the problem. The entity wasn’t actually being updated in your example, so I added the line “entity.polygon.heightReference = newHr” and the error reappeared.

---

<div class="post-metadata">

**Author:** ![Jessica\_Gettings](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@Jessica\_Gettings](https://community.cesium.com/u/Jessica_Gettings)\
**Post date:** [August 22, 2018, 5:06pm UTC](https://community.cesium.com/t/polygons-with-heightreference-perpositionheight-no-extrusion/7291/5 "2018-08-22T17:06:21Z")

</div>

Sorry, I see - I went and reset it to a constant property. I’m having trouble getting it working in my own code, but I see how the example works now. Thank you.

---

<div class="post-metadata">

**Author:** ![Jessica\_Gettings](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@Jessica\_Gettings](https://community.cesium.com/u/Jessica_Gettings)\
**Post date:** [August 23, 2018, 1:19am UTC](https://community.cesium.com/t/polygons-with-heightreference-perpositionheight-no-extrusion/7291/6 "2018-08-23T01:19:03Z")

</div>

So it turns out when I start by setting the heightReference result to CLAMP\_TO\_GROUND, rather than starting with NONE, the error occurs even when using a callback. [Here’s the example](https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/#c=nVZrc+I2FP0rGr7ETF0B25AhIWSaEnbDlA0MIdvplA4j7IutiZBcSSZld/jve/0C4zw2rflgLN1zfO7VfXjDNPHA8Hg9A60ZlxOtNtwHTXqkn65TTwOz8IfSws9tnHp3LjeIBCF4ZBT3n4MlPBUEg1esUpqMaMPhqQr7kq45J5m8vpIWsaBPXPJtLgleS2ZgxLagJ9x7RPQFWTFhwM12bUXSxct+zuUuk9FoEB8iGyLQWMICtMF7zkK4IRr+ibkGn1hF1uwRiA2BREpsAyUN8QRbR8lWjkgJEwpgPlErYkL1xGWAIK3iICTckpVWaxJLFBHgmvQxFKnL1HgggQZCLYGmmmYo6TpTlMvHUFkdQ6o8C6FQMuA29gG3zmin3Txrtc87+Gu2P7Ty8xLMFianbdo5b5+etTvn5+ennc5ZbuKDsAz3m7TZbO3PJwQehHYKK9AgPTgkx+3xBu2Prj9PFrPx4tN0/HB3kxEUXmkAeR8xDwYbkPaWSV8k62CHMorttWe5kk52eqtYZo/14rST6/Av50QabjkYumEixttK6QHzQqdkuWdKbbfIV9pMqRL/ktyrONk9NnsOwly91d3XbfiKOPPavEZ+Svl7PZI/vRK7u/Hd4Mjd4vIwwZQAKlSAhBgvm2aSypJuXqt3n2NSce8/p4r0HZa2gf+kRSoJ/0tK4nYFtXsr9GUFJ1YFgUgUZIeHRZrTXpATjHT66nr3vXRZitC8qGklId7meV4iWX4crHYFwS5vUXlA7iuFMdtGQEeDj7PFzfjht9Fg0R8N+79nXarIvaekSfUORd89bAE73sIwYDG3juBGxdjpevuGUIJLpY+2DvDCgh3Oss80tkvO5C806WY3EKArxknUudlL6iXg8p3AVEIZ6P0QmDj9AtB/J3Av9QCNlOFJ3zBI8RdzydIlnkv8vwv2SgNivu+UyiVPIZw6lRqKcFzlzFkhXKSN3K0kEwfNtBdukWAvpGKzxqmsORNoUriohNKpd1PsrWrtfGMiChkatHZ19+10vSiP3j4TYsm8RxySqNdunZfbcXFpsLGWP+ifOzcbz/VSQeTlUC/GWBZTj63ReyxI9XhtnbePb5/l7j5hXdJuNutu2Z9bHMLYJCbceiGGJoCC9TOzIZ0MXfLz8cJi/GUwXXwcP0xd8qGJdOkXzwvyZppJg1NnXWLU/N9TOrwZ3M2Gsz/r3ZpbuzR2K+Aqc/dXvo4wT0mshUNpw8I6QulgGssYP2Ms9YxJ3nbZKECXPt8Q7vfmtcqnEA4TnADG4M4qFuKef8UOfHXZQPsjmFCp++MNaMG2iUnYuhpli5TSywY+PkdZpTAJdInxOw); the only difference between this and the last example is in line 18.

---

<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:** [August 27, 2018, 1:48pm UTC](https://community.cesium.com/t/polygons-with-heightreference-perpositionheight-no-extrusion/7291/7 "2018-08-27T13:48:58Z")

</div>

So I’m only getting the error if perPositionHeight is enabled. I don’t think you need it for this case. Instead, make sure you specify the height, and use a value that will put the entity above terrain so you can see it.

I am having trouble with the toggling using a CallbackProperty. I went back to setting heightReference directly and it seemed to work fine.

[Here’s](https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/#c=rVZtbyI3EP4rFl8C6tbANUS8Rk0Jd0HlAiLkqqpUyOwOu1aMvbW9pPSU/97ZN1g2OS6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NHiVbQuMmv99Sce3o/vFePF7rVdxKn1j9wKu03B/5tsQC49EWlQprVvYhigdTH0d4QeNpa4x8W79eg7qe3xHuDdYVkofRXgl4T1iDFo2kRAP/B8cvdf9OvqfwIRKwp/uQAu2j12C5vUkXaSU9uv4+hpllRJrpguM/wI) a working example.

---

<div class="post-metadata">

**Author:** ![Jessica\_Gettings](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@Jessica\_Gettings](https://community.cesium.com/u/Jessica_Gettings)\
**Post date:** [August 28, 2018, 11:57pm UTC](https://community.cesium.com/t/polygons-with-heightreference-perpositionheight-no-extrusion/7291/8 "2018-08-28T23:57:23Z")

</div>

I’ve found a way to get around this in my current code, but it seems like Cesium should support the ability to create a polygon that’s non-extruded, relativeToGround, and has perPositionHeight all at the same time. Does anyone know if there are plans to get this fixed in the future?

---

<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:** [August 30, 2018, 2:07pm UTC](https://community.cesium.com/t/polygons-with-heightreference-perpositionheight-no-extrusion/7291/9 "2018-08-30T14:07:20Z")

</div>

It should be supported. I went ahead an opened an issue, [#6976](https://github.com/AnalyticalGraphicsInc/cesium/issues/6976). We may not be able to get to this right away, but if you could help by tracking down the error or providing a fix, contributions are greatly appreciated!

Thanks,

Gabby

---

<div class="post-metadata">

**Author:** ![hannah](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/hannah/32/4509_2.png) [@hannah](https://community.cesium.com/u/hannah)\
**Post date:** [August 30, 2018, 8:00pm UTC](https://community.cesium.com/t/polygons-with-heightreference-perpositionheight-no-extrusion/7291/10 "2018-08-30T20:00:24Z")

</div>

Hello,

heightReference is currently not compatible with perPositionHeight. I’ve opened this pull request to fix the DeveloperError and print a warning to the console instead: [https://github.com/AnalyticalGraphicsInc/cesium/pull/6978](https://github.com/AnalyticalGraphicsInc/cesium/pull/6978)

We’ll keep issue #6976 open and notify you when we have a chance to add support for that case.

Best,

Hannah

---

<div class="post-metadata">

**Author:** ![Jessica\_Gettings](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@Jessica\_Gettings](https://community.cesium.com/u/Jessica_Gettings)\
**Post date:** [September 9, 2018, 11:14pm UTC](https://community.cesium.com/t/polygons-with-heightreference-perpositionheight-no-extrusion/7291/11 "2018-09-09T23:14:24Z")

</div>

Thank you both.
