{"action":"created","issue":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/2021","labels_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/2021/labels{/name}","comments_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/2021/comments","events_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/2021/events","html_url":"https://github.com/mapbox/mapbox-gl-js/issues/2021","id":129726497,"number":2021,"title":"Cost of drawing overlapping polygons","user":{"login":"averas","id":1205805,"avatar_url":"https://avatars.githubusercontent.com/u/1205805?v=3","gravatar_id":"","url":"https://api.github.com/users/averas","html_url":"https://github.com/averas","followers_url":"https://api.github.com/users/averas/followers","following_url":"https://api.github.com/users/averas/following{/other_user}","gists_url":"https://api.github.com/users/averas/gists{/gist_id}","starred_url":"https://api.github.com/users/averas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/averas/subscriptions","organizations_url":"https://api.github.com/users/averas/orgs","repos_url":"https://api.github.com/users/averas/repos","events_url":"https://api.github.com/users/averas/events{/privacy}","received_events_url":"https://api.github.com/users/averas/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-01-29T10:30:14Z","updated_at":"2016-01-29T19:43:13Z","closed_at":"2016-01-29T19:33:36Z","body":"In #1879 I described a use case where I use polygons to render color relief. This actually works quite well and starts to look as beautiful as when made with mapnik.\r\n\r\nHowever, in the previous issue I also mentioned that I noticed that using overlapping polygons seemed to be less performant than using non-overlapping polygons. Scaling this up a bit I experience considerable difference in drawing non-overlapping polygons vs. overlapping polygons, even when the underlying polygons don't show. Performance is far greater with the <code>earcut-final</code> branch, but still hampered with many overlapping polygons. With non-overlapping polygons performance is acceptable even with 100+ layers.\r\n\r\nIdeally I would just go with non-overlapping polygons, but another problem struck me there - simplification. At certain zoom levels simplification creates slivers that affect UX badly:\r\n\r\n![image](https://cloud.githubusercontent.com/assets/1205805/12673034/88e0fb54-c67a-11e5-8909-64a9f51ef596.png)\r\n\r\n1) Is there any way to affect simplification when using vector tiles? (this is not a GeoJSON source)\r\n\r\n2) Is it possible in theory to improve mapbox-gl-js with smarter layering logics? I experience most performance degradation at high zoom levels when many layers are in the viewport, but when few are actually visible (because of overlap) I.e. would it be possible to establish that the layer on top is actually covering the layers below and discard them? Perhaps this is what is actually happening and is what is expensive..\r\n\r\nAnother way to go would be to buffer my non-overlapping polygons a bit to avoid slivers caused by simplification, but that gives them faulty coverage which presents itself when not showing all layers."},"comment":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/comments/176935071","html_url":"https://github.com/mapbox/mapbox-gl-js/issues/2021#issuecomment-176935071","issue_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/2021","id":176935071,"user":{"login":"jfirebaugh","id":98601,"avatar_url":"https://avatars.githubusercontent.com/u/98601?v=3","gravatar_id":"","url":"https://api.github.com/users/jfirebaugh","html_url":"https://github.com/jfirebaugh","followers_url":"https://api.github.com/users/jfirebaugh/followers","following_url":"https://api.github.com/users/jfirebaugh/following{/other_user}","gists_url":"https://api.github.com/users/jfirebaugh/gists{/gist_id}","starred_url":"https://api.github.com/users/jfirebaugh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfirebaugh/subscriptions","organizations_url":"https://api.github.com/users/jfirebaugh/orgs","repos_url":"https://api.github.com/users/jfirebaugh/repos","events_url":"https://api.github.com/users/jfirebaugh/events{/privacy}","received_events_url":"https://api.github.com/users/jfirebaugh/received_events","type":"User","site_admin":false},"created_at":"2016-01-29T19:43:13Z","updated_at":"2016-01-29T19:43:13Z","body":"Another thing that will help this use case greatly is data-driven styles, which will allow you to go from 100+ layers to 1 layer."}}