polygon outline display problem on small scale

Small scale, polygon
outline is not continuous, display normal when zoom in , what is the reason, it is done to optimize the outline to improve efficiency?

Hi Arc Z,

I believe this is just a standard anti-aliasing issue. Try experimenting with outlineWidth to change the appearance.

Hope that helps,

  • Rachel

Hi Rachel Hwang, thank you !
I want to change the outlineWidth , but it dosen’t work ,can you tell me why
var source = new Cesium.GeoJsonDataSource(‘gd’);
viewer.dataSources.add(source);
source.load(’./gd.json’, {
stroke: Cesium.Color.CYAN,
fill: Cesium.Color.fromRandom(),
strokeWidth: 3,
markerSymbol: ‘?’
}).then(function(){
var p = source.entities.values;
for (var i = 0; i < p.length; i++) {
p[i].polygon.extrudedHeight = 3000;
var color = Cesium.Color.fromRandom({
alpha : 1.0
});
p[i].polygon.material = Cesium.Color.fromBytes(17,49,167,255);
p[i].polygon.outlineColor = Cesium.Color.fromBytes(255,255,255,255);
p[i].polygon.outlineWidth = 5; // not work
}
});

在 2017年6月6日星期二 UTC+8上午2:24:34,Rachel Hwang写道:

outlineWidth will not work on Windows see here for details: https://stackoverflow.com/questions/25394677/how-do-you-change-the-width-on-an-ellipseoutlinegeometry-in-cesium-map/25405483#25405483

The problem here is z-fighting, a common problem in 3D rendering. Your polygons technically overlap at the edges, so the outline and fill both fight with each other causing the image you pasted above. There is an easy work around, change both alpha values in your Color to 254 instead of 255. This makes them technically translucent (though it is slow slight that you don’t see it).

Here’s a Sandcastle example that shows this in action. Change them back to 255 in the example and the problem will pop back up:

http://cesiumjs.org/Cesium/Apps/Sandcastle/?src=Hello%20World.html&label=Showcases&gist=cd9a105ed361c8a78bb8a0a6859d824c

I’m hoping that in the future we can come up with a good heuristic for handling stuff like this automatically, but for now the workaround is easy enough.

Hope that helps,

Matt

thank you Matt.

[I tried as you told me, but it
bring another problem.

](https://lh3.googleusercontent.com/-nSqRT3fbnmo/WTe-NKHGApI/AAAAAAAAAB8/IbNBX9el1ygroLCbQoW807YUZWu6Ul9BQCLcB/s1600/pb.png)

[

](https://lh3.googleusercontent.com/-nSqRT3fbnmo/WTe-NKHGApI/AAAAAAAAAB8/IbNBX9el1ygroLCbQoW807YUZWu6Ul9BQCLcB/s1600/pb.png)

[Actually in my computer chrome
browser is right, but my firefox and other’s computer chrome is wrong. is
it worked with hardware?

](https://lh3.googleusercontent.com/-nSqRT3fbnmo/WTe-NKHGApI/AAAAAAAAAB8/IbNBX9el1ygroLCbQoW807YUZWu6Ul9BQCLcB/s1600/pb.png)

I changed the ‘material’
parameter, ‘alpha’ from 255 to 254 ,but the label of the marker is hided by the
entity. not familiar with the demo
[http://cesiumjs.org/Cesium/Apps/Sandcastle/?src=Hello%20World.html&label=Showcases&gist=cd9a105ed361c8a78bb8a0a6859d824c
, my entity has parameter ‘extrudedHeight’, so my ‘alpha’ must be
255 ensure the outline (not on the edge) is hided by the ‘material’

](http://cesiumjs.org/Cesium/Apps/Sandcastle/?src=Hello%20World.html&label=Showcases&gist=cd9a105ed361c8a78bb8a0a6859d824c %20, %20my%20entity%20has%20parameter%20’extrudedHeight’,%20so%20my%20’alpha’%20must%20be%20255%20ensure%20the%20outline%20(not%20on%20the%20edge)%20is%20hided%20by%20the%20%20’material’%0b)

在 2017年6月6日星期二 UTC+8下午9:34:18,Matthew Amato写道:

Hi Arc Z,

You can get your label to display over the terrain always by following the “disable depth test…” example here: http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Billboards.html&label=All

hope that helps,

  • Rachel