mapbox / simplespec-to-gl-style

Converts GeoJSON styled with simplestyle-spec to a GL Style
ISC License
31 stars 6 forks source link

[WIP] sorted features based on type #31

Open allierowan opened 7 years ago

allierowan commented 7 years ago

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

bsudekum commented 7 years ago

@allierowan can you add a test?

order in:

order out:

allierowan commented 7 years ago

@bsudekum added a test - what do you mean by order out and order in?

Thanks!

bsudekum commented 7 years ago

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.

allierowan commented 7 years ago

Okay I thought that's what you meant but just wanted to be sure 👍

bsudekum commented 7 years ago

Another test to take a look at: ['point', 'point', 'line', 'point', 'line', 'point'] -> ['point', 'point', 'point', 'point', 'line', 'line']

allierowan commented 7 years ago

@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'
    };
bsudekum commented 7 years ago

@allierowan no, it should not matter. They are linked by the sourceId.

allierowan commented 7 years ago

@bsudekum based on my test, it should be ['line', 'line', 'point', 'point', 'point', 'point']?