Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Support new style format #172

Closed
Closed

Description

@edenh

Now that mapbox/mapbox-gl-js#363 is merged, tracking this task here.

Activity

  1. incanus commented on May 7, 2014

    @incanus
    Contributor

    👍

    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.

  2. edenh commented on May 7, 2014

    @edenh
    ContributorAuthor

    It would allow us to move quicker on #171, but we can punt if it's a distraction for wwdc.

  3. incanus commented on May 7, 2014

    @incanus
    Contributor

    Ah, ok. Adding to the milestone, then, so we can plan accordingly. Can always drop if it proves too tricky for the time left.

  4. added this to the WWDC milestone on May 7, 2014
  5. incanus commented on May 12, 2014

    @incanus
    Contributor

    I'm going to try to get an ETA on this today, as @edenh says this will greatly increase debug turnaround time.

  6. edenh commented on May 12, 2014

    @edenh
    ContributorAuthor

    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

  7. mourner commented on May 13, 2014

    @mourner
    Member

    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.

  8. edenh commented on May 13, 2014

    @edenh
    ContributorAuthor

    @wsnook just incase you needed even more context, there is mapbox/mapbox-gl-js#356

  9. kkaefer commented on May 14, 2014

    @kkaefer
    Member

    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?

  10. kkaefer commented on May 14, 2014

    @kkaefer
    Member

    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.

  11. edenh commented on May 14, 2014

    @edenh
    ContributorAuthor

    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 building bucket, while 3 styles reference it: https://github.com/mapbox/gl-style/blob/master/test/styles/bright-raw.js#L384-L393

    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.

  12. mourner commented on May 14, 2014

    @mourner
    Member

    @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

  13. 28 remaining items

  14. ghost added a commit that references this issue on May 22, 2014
  15. ghost added a commit that references this issue on May 22, 2014
  16. ghost added a commit that references this issue on May 22, 2014
  17. ghost added a commit that references this issue on May 23, 2014
  18. ghost added a commit that references this issue on May 23, 2014
  19. ghost added a commit that references this issue on May 23, 2014
  20. ghost added a commit that references this issue on May 23, 2014
  21. removed this from the WWDC milestone on May 28, 2014
  22. Repository owner unassigned on Jun 4, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    GL JS parity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions