Open allierowan opened 7 years ago
@allierowan can you add a test?
order in:
order out:
@bsudekum added a test - what do you mean by order out
and order in
?
Thanks!
Take a look at these two feature collections:
If a line is first in the feature collection, then after sorting it should come out second.
Okay I thought that's what you meant but just wanted to be sure 👍
Another test to take a look at: ['point', 'point', 'line', 'point', 'line', 'point']
-> ['point', 'point', 'point', 'point', 'line', 'line']
@bsudekum yep good call. Right now I'm just trying to fix these tests that were relying on order - does it matter if the sources and layers are in different orders?
var style = {
version: 8,
sources: makeSource(geojson, sourceId),
layers: addLayers(geojson, sourceId, []),
glyphs: 'mapbox://fonts/mapbox/{fontstack}/{range}.pbf'
};
@allierowan no, it should not matter. They are linked by the sourceId
.
@bsudekum based on my test, it should be ['line', 'line', 'point', 'point', 'point', 'point']?
I assigned the feature types numbers to use for sorting, where MultiPoint and Point are last. From my understanding, the rest of the features' order does not matter - is that correct?
Also, is this order right? i.e. if Points are last than they will overlap everything else?
Lastly, was going to think on this a bit more to see if there is a way to do it without sorting and then looping, since it is adding computing time. I'm going to play around with sorting inside of the loop.
cc/ @bsudekum