# z-order i3dm and VectorData-Polygons

**URL:** <https://community.cesium.com/t/z-order-i3dm-and-vectordata-polygons/7103>\
**Category:** CesiumJS\
**Created:** [June 28, 2018, 3:34pm UTC](https://community.cesium.com/t/z-order-i3dm-and-vectordata-polygons/7103 "2018-06-28T15:34:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![maximus.knopps](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@maximus.knopps](https://community.cesium.com/u/maximus.knopps)\
**Post date:** [June 28, 2018, 3:34pm UTC](https://community.cesium.com/t/z-order-i3dm-and-vectordata-polygons/7103/1 "2018-06-28T15:34:53Z")

</div>

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

I have added vector data polygons (\*.vctr) and i3dm data to the scene. The pixels of i3dm data are overlayed by vector data. But I expect to see the trees as they are, without the red color from vector data.

I tried to change the order of primitives.add, but it does not change the draw order.

Can I configure something to change the z-order?

I found a todo "Future work Polygon z-order": [https://github.com/AnalyticalGraphicsInc/cesium/pull/4665](https://github.com/AnalyticalGraphicsInc/cesium/pull/4665) may be it is a known issue?

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

var viewer = new Cesium.Viewer('cesiumContainer', {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;terrainProvider: Cesium.createWorldTerrain()  
&nbsp;&nbsp;});

var flstTileset = new Cesium.Cesium3DTileset({  
&nbsp;&nbsp;&nbsp;&nbsp;url: ‘[https://raw.githubusercontent.com/vitjok/testfile/master/vectordata/](https://raw.githubusercontent.com/vitjok/testfile/master/vectordata/)’  
});  
flstTileset.style = new Cesium.Cesium3DTileStyle({  
&nbsp;&nbsp;&nbsp;&nbsp;color: ‘rgba(255, 0, 0, 0.3)’  
});  
var vctr = viewer.scene.primitives.add(flstTileset);

var treeTileset = new Cesium.Cesium3DTileset({  
&nbsp;&nbsp;&nbsp;&nbsp;url: ‘[https://raw.githubusercontent.com/vitjok/testfile/master/i3dm/](https://raw.githubusercontent.com/vitjok/testfile/master/i3dm/)’  
});  
var tree = viewer.scene.primitives.add(treeTileset);

viewer.zoomTo(flstTileset);

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

I want to see the Polygons on the terrain and the trees over the terrain and over the Polygons.

4. The Cesium version you're using, your operating system and browser.

Cesium 1.46  
Windows 10  
Chrome 67.0.3396.87

---

<div class="post-metadata">

**Author:** ![maximus.knopps](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@maximus.knopps](https://community.cesium.com/u/maximus.knopps)\
**Post date:** [June 28, 2018, 3:38pm UTC](https://community.cesium.com/t/z-order-i3dm-and-vectordata-polygons/7103/2 "2018-06-28T15:38:11Z")

</div>

code example in Sandcastle: [https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/#c=vZLBSgMxEIZfJexlt1AStfRS1yLoUVBo0cte0mTaRrNJmcymtOK7m+22uFXEmyEQMjP/zDeTRIksGtgCshvmYMvuIJim5s8HW5Grw/XOO5LGAeZD9l45dlwEiMn8hD4aDTg5iRWCJHjxaPW8CykGlavoY3CdDhdTzaUNNDcWAtB54e4Y3R+dxbFcg3bC8jXRJkyEQLnlK0PrZtEEQJXowBFXvhbR0Kt/EwSBlimDqGVIlCKCIo9akhR55Q4cPQIeaGfhd45Z6z6RKG99ajXH1UIWV+PxkF10m48Gp9xth1FRO9NuuDwocMA3aGpDJkLgUuuih/A1GUKAf5yMGela9Lnb+n9w9xA77qTswvfe13P/vbFsmJWHEU875FtTbzxSi15wnpDqjU0fJohFo97Sc6gQWlkpTqJSm8iMvqmyb/+xypiyMoTkWTbWzsweqmxaihR/JrNeauNWjxHQyl0bsr6cPnRGznkp0vWniry3C4m9jJ8](https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/#c=vZLBSgMxEIZfJexlt1AStfRS1yLoUVBo0cte0mTaRrNJmcymtOK7m+22uFXEmyEQMjP/zDeTRIksGtgCshvmYMvuIJim5s8HW5Grw/XOO5LGAeZD9l45dlwEiMn8hD4aDTg5iRWCJHjxaPW8CykGlavoY3CdDhdTzaUNNDcWAtB54e4Y3R+dxbFcg3bC8jXRJkyEQLnlK0PrZtEEQJXowBFXvhbR0Kt/EwSBlimDqGVIlCKCIo9akhR55Q4cPQIeaGfhd45Z6z6RKG99ajXH1UIWV+PxkF10m48Gp9xth1FRO9NuuDwocMA3aGpDJkLgUuuih/A1GUKAf5yMGela9Lnb+n9w9xA77qTswvfe13P/vbFsmJWHEU875FtTbzxSi15wnpDqjU0fJohFo97Sc6gQWlkpTqJSm8iMvqmyb/+xypiyMoTkWTbWzsweqmxaihR/JrNeauNWjxHQyl0bsr6cPnRGznkp0vWniry3C4m9jJ8)

---

<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:** [June 29, 2018, 2:14pm UTC](https://community.cesium.com/t/z-order-i3dm-and-vectordata-polygons/7103/3 "2018-06-29T14:14:33Z")

</div>

Hi Maximus,

We have added [geometry z-ordering](https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/index.html?src=Z-Indexing%20Geometry.html&label=New%20in%201.46) in Cesium 1.46, however as you pointed out, it has no made it’s way into vector tiles yet (as they are still experimental). [3D Tiles Issue #69](https://github.com/AnalyticalGraphicsInc/3d-tiles/issues/69)covers adding it to the specification, I’ll bump that issue with this request.

Thanks,

Gabby

---

<div class="post-metadata">

**Author:** ![maximus.knopps](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@maximus.knopps](https://community.cesium.com/u/maximus.knopps)\
**Post date:** [August 8, 2018, 4:19pm UTC](https://community.cesium.com/t/z-order-i3dm-and-vectordata-polygons/7103/4 "2018-08-08T16:19:37Z")

</div>

Hi Gabby,

I just noticed, that the sample does not work anymore (in current Version I have to append tileset.json to the url option).

And then (more important) I noticed a post about ClassificationType.TERRAIN [https://cesiumjs.org/forum/#!msg/cesium-dev/1ptAh6n82KM/1kEFweikAQAJ](https://cesiumjs.org/forum/#!msg/cesium-dev/1ptAh6n82KM/1kEFweikAQAJ) (by Dan Bagnell).

This option seams to fix the issue.

Sample code:

```auto
var viewer = new Cesium.Viewer('cesiumContainer', {
        terrainProvider: Cesium.createWorldTerrain()
        });

var flstTileset = new Cesium.Cesium3DTileset({
    classificationType: Cesium.ClassificationType.TERRAIN,
    url: 'https://raw.githubusercontent.com/vitjok/testfile/master/vectordata/tileset.json'
});
flstTileset.style = new Cesium.Cesium3DTileStyle({
    color: 'rgba(255, 0, 0, 0.3)'
});
var vctr = viewer.scene.primitives.add(flstTileset);

var treeTileset = new Cesium.Cesium3DTileset({
    url: 'https://raw.githubusercontent.com/vitjok/testfile/master/i3dm/tileset.json'
});
var tree = viewer.scene.primitives.add(treeTileset);

viewer.zoomTo(flstTileset);

```

Thanks,  
Maximus

---

<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 9, 2018, 6:12pm UTC](https://community.cesium.com/t/z-order-i3dm-and-vectordata-polygons/7103/5 "2018-08-09T18:12:09Z")

</div>

Perfect, thanks for the update! Setting the classification type to terrain will indeed work in this case, good thinking.
