You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
I could write a backwards script — shouldn't take more than a day, although it seems to me that supporting new style format in llmr-native isn't a lot of work either.
The general idea of the new style format is to reduce the conceptual complexity.
Basically, what used to be buckets is now part of the styles and classes. Note that we still need to generate the bucket objects, but we implicitly deduce them from styles and the associated class from classes.
For generating the correct buckets, we have to go through the structure, and pull the associated style (with structure.name == style.name) from the default class, then extract all the parse-time properties (like line-cap, line-join, text-path, text-max-size, text-field and so on (some of which we currently don't support, btw)) and write them to the bucket description along with the filters from the structure array, and create a style class from the rest. Note that we don't have type fields anymore, so we have to look at what sort of properties the class has.
@mourner When a class specifies fill-* and line-* properties, do we create two buckets and two styles? What's the JS semantics here?
Also, we need to do some bucket deduplication, i.e. filter out buckets that have the same set of filters + properties, and make the structure objects link to a single bucket. This is important so that we don't duplicate all of the geometry for things like offset building shadows.
@kkaefer the idea is to have one bucket that can specify several types. Currently llmr doesn't handle multiple types at once, but could be updated to do this pretty easily I assume.
As @edenh mentioned, buckets are deduplicated, it just doesn't handle the case where buckets with the same filter but different properties (like line-cap) get merged into one — it just chooses one of the values for the merged bucket. We could instead only merge completely identical buckets, and create different buckets if the properties are different (and maybe throw a warning that it's not recommended because it slows things down). I don't think it's a critical issue though, as I don't yet know any practical cases where you would want to have different bucket properties, as double buckets are currently only used for casings. cc @ansis
28 remaining items
ghost added a commit that references this issue on May 22, 2014
Activity
incanus commentedon May 7, 2014
👍
I'm going to leave it off the WWDC milestone for now unless not moving to it before then presents a problem or we have sufficient time to do it.
edenh commentedon May 7, 2014
It would allow us to move quicker on #171, but we can punt if it's a distraction for wwdc.
incanus commentedon May 7, 2014
Ah, ok. Adding to the milestone, then, so we can plan accordingly. Can always drop if it proves too tricky for the time left.
incanus commentedon May 12, 2014
I'm going to try to get an ETA on this today, as @edenh says this will greatly increase debug turnaround time.
edenh commentedon May 12, 2014
A stopgap fix for this could be a gl-style script that converts from v1 backwards to v0. Not sure if this is worth pursuing. cc @mourner
mourner commentedon May 13, 2014
I could write a backwards script — shouldn't take more than a day, although it seems to me that supporting new style format in llmr-native isn't a lot of work either.
edenh commentedon May 13, 2014
@wsnook just incase you needed even more context, there is mapbox/mapbox-gl-js#356
kkaefer commentedon May 14, 2014
The general idea of the new style format is to reduce the conceptual complexity.
Basically, what used to be
bucketsis now part of thestylesandclasses. Note that we still need to generate the bucket objects, but we implicitly deduce them fromstylesand the associated class fromclasses.For generating the correct buckets, we have to go through the
structure, and pull the associated style (withstructure.name==style.name) from thedefaultclass, then extract all the parse-time properties (likeline-cap,line-join,text-path,text-max-size,text-fieldand so on (some of which we currently don't support, btw)) and write them to the bucket description along with the filters from the structure array, and create a style class from the rest. Note that we don't havetypefields anymore, so we have to look at what sort of properties the class has.@mourner When a class specifies
fill-*andline-*properties, do we create two buckets and two styles? What's the JS semantics here?kkaefer commentedon May 14, 2014
Also, we need to do some bucket deduplication, i.e. filter out buckets that have the same set of filters + properties, and make the structure objects link to a single bucket. This is important so that we don't duplicate all of the geometry for things like offset building shadows.
edenh commentedon May 14, 2014
I was curious so I ran the following v1 stylesheet through the converter:
{ "version": "1", "layers": [ {"id": "background"}, { "id": "road_label", "filter": { "source": "source", "layer": "road_label" } } ], "styles": { "default": { "background": { "fill-color": "red" }, "road_label": { "point-color": "blue", "point-radius": 10, "text-field": "name", "text-color": "blue", "text-size": 10 } } } }output:
{ "version": "1", "buckets": { "road_label": { "filter": { "source": "source", "layer": "road_label" }, "point": true, "text": true, "text-field": "name" } }, "layers": [ { "id": "background" }, { "id": "road_label", "bucket": "road_label" } ], "styles": { "default": { "background": { "fill-color": "red" }, "road_label": { "point-color": "blue", "point-radius": 10, "text-color": "blue", "text-size": 10 } } } }Instead of two buckets for
road_label, there is a single bucket with two types defined.Also, bucket deduplication is already happening. https://github.com/mapbox/gl-style/blob/master/test/styles/bright-raw.js#L58-L60 is a single
buildingbucket, while 3 styles reference it: https://github.com/mapbox/gl-style/blob/master/test/styles/bright-raw.js#L384-L393In the v1 style, three building layers are defined: https://github.com/mapbox/gl-style/blob/master/test/styles/bright-v1.js#L44-L53, which in my opinion is preferable so that there is a direct relationship via id's.
mourner commentedon May 14, 2014
@kkaefer the idea is to have one bucket that can specify several types. Currently llmr doesn't handle multiple types at once, but could be updated to do this pretty easily I assume.
As @edenh mentioned, buckets are deduplicated, it just doesn't handle the case where buckets with the same filter but different properties (like line-cap) get merged into one — it just chooses one of the values for the merged bucket. We could instead only merge completely identical buckets, and create different buckets if the properties are different (and maybe throw a warning that it's not recommended because it slows things down). I don't think it's a critical issue though, as I don't yet know any practical cases where you would want to have different bucket properties, as double buckets are currently only used for casings. cc @ansis
28 remaining items
#172 Implemented bucket `filter`
Merge from master (#140 nested layers). See #172 #230.
#172 #230 Merge latest master
#172 #230 Fixed feature_type detection!
#172 #230 Latest outoors style migrated to v1
#172 #230 Improved line & fill parsing
#172 #320 Fixed off by one in stops fn
add missing include to fix error: ‘exception_ptr’ in namespace ‘std’ …