-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Support new style format #172
Comments
👍 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. |
It would allow us to move quicker on #171, but we can punt if it's a distraction for wwdc. |
Ah, ok. Adding to the milestone, then, so we can plan accordingly. Can always drop if it proves too tricky for the time left. |
I'm going to try to get an ETA on this today, as @edenh says this will greatly increase debug turnaround time. |
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. |
I'm starting to take a look at this. Some notes:
|
@wsnook just incase you needed even more context, there is mapbox/mapbox-gl-js#356 |
@edenh Oh, nice. Context is my friend. Thanks. |
The general idea of the new style format is to reduce the conceptual complexity. Basically, what used to be For generating the correct buckets, we have to go through the @mourner When a class specifies |
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. |
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 Also, bucket deduplication is already happening. https://github.com/mapbox/gl-style/blob/master/test/styles/bright-raw.js#L58-L60 is a single In 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. |
@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 |
I think I'm finally understanding how all this stuff fits together. It seems like the most straightforward way to keep native in sync with web would be a pretty direct port of the js changes from mapbox/llmr#363 over to native. @incanus I think this probably needs to go a bit beyond what you were saying about the changes being confined to |
No, that's sounding right. I didn't understand the bucket changes earlier. |
For the native port to catch up to web, these changes need to be made:
... and potentially also this:
|
Note to self: do not trust the syntax of the mapbox/gl-style v1 test file because it is rather different than what llmr is actually using after the newstyle merge. In particular, note the @mourner Does this sound right? /cc @edenh |
@wsnook v1 version is user-friendly, while the script can convert v1 styles to renderer-friendly styles that have buckets and stuff. These have |
@mourner So your expectation is that designers will always run the script and that llmr & llmr-native should expect the raw format? |
@wsnook the preprocessing script is also a part of tm2-gl, a visual map style editor now in development, so designers won't have to do this manually. |
@mourner Okay, cool. That makes a lot of sense, and I'm pretty sure I understand now how the pieces need to fit together. |
Status update: I'm making good progress at annotating the specific changes which were made to llmr's style format as a part of PR mapbox/mapbox-gl-js#363, and I'm using that to fill out my giant checklist (a few comments up) of all the adjustments which must be made to llmr-native's style format. The checklist will be useful for ensuring all the changes get made, and I expect it could potentially also be helpful for writing documentation about what changed. |
@mourner Awesome. I just grabbed a copy of that.
|
I'm getting very suspicious that llmr-native's v0 style parser ignores many of the v0 keys which were supported by llmr before the new style format change. If you scroll up a bit and look at my checklist of changes that I've made, you'll see a lot of holes for things like |
You're right -- |
Okay, cool. I was getting a little confused there for a while. |
Status Upate: So far I'm checking lots of changes off my todo list, and the app is not crashing, but it's also showing an empty white map. My expectation is that at some point it will magically start looking like an 80% correct outdoors map, then the question becomes how hard is it to get the remaining stuff looking right? I'm optimistic this can be finished by the end of the week, but there could easily be some time consuming obstacles that I can't see from here. |
For tomorrow, the next thing I need to do is get |
Bucket filtering works, and it draws a map now! Granted, it's kind of a crazy looking map... the fact that nested layers are not supported yet is definitely a problem with the v1 outdoors test style, and there might easily be other problems. I'm hoping that maybe merging this with #140 will magically fix some or all of the map craziness. |
…does not name a type (mapbox#172) Signed-off-by: Nuno Goncalves <nunojpg@gmail.com>
Now that mapbox/mapbox-gl-js#363 is merged, tracking this task here.
The text was updated successfully, but these errors were encountered: