Giter Club home page Giter Club logo

mapbox-filter's People

Contributors

ondrap avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mapbox-filter's Issues

error parsing style file

Hello, this library sounds really useful. I am trying it out but get the following error

mapbox-filter: Parsing mapbox style failed: Error in $.layers[1]: Unknown function name / wrong param count: in CallStack (from HasCallStack): error, called at app/Main.hs:224:20 in main:Main

I think it might be caused by this part in the second layer in my style layers (at index 1 of layers):

"filter": [ "all", [ "in", "class", "residential", "suburb", "neighbourhood" ] ],

I understand not all expressions are supported. Is the 'in' not supported yet?

Thanks!

[Feature Request]: `match` expression support

Hi dear,

I'd appreciate if you add match expression support.

I use openmaptile styles which has in and !in filter statements. I saw that filters are depricated. So, I changed it to match expression but unfortunately it's not supported in your app yet.

Thank you!

Support set filters

First of all, thanks for creating and sharing this tool @ondrap :)

I use a style which has a in filter.
This seems not supported right now.

It would be awesome if you could add this, or tell me how to workaround it.
An example is below. It will currently produce Parsing mapbox style failed: Error in $.layers[X]: Unknown function name / wrong param count: in

"filter": [
        "all",
        [
          "in",
          "building",
          "cathedral",
          "chapel",
          "church",
          "mosque",
          "temple",
          "synagogue",
          "shrine",
          "civic",
          "hospital",
          "school",
          "stadium",
          "train_station",
          "transportation",
          "university"
        ]
      ]

Another example:

"filter": [
        "all",
        [
          "in",
          "highway",
          "primary",
          "trunk"
        ],
        [
          "==",
          "tunnel",
          "yes"
        ]
      ]

`source` and `source-layer` are optional for layer type background

According to the style spec the source is required except for the background layer (which is nothing but a plain color mostly).

Example:

{
  "id": "background",
  "type": "background",
  "layout": {
    "visibility": "visible"
  },
  "paint": {
    "background-color": "rgba(235, 237, 215, 1)"
  }
}

Currently it will error with Parsing mapbox style failed: Error in $.layers[X]: key "source" not present

equality and inequality expressions

Hi buddy!

I have the following filter in my style but I get Comparing unequal things: Fix (UApp "get" (Fix (UStr "subclass"))), Fix (UStr "glacier"): Anyvs. String error.

      "filter": [
        "==",
        [
          "get",
          "subclass"
        ],
        "glacier"
      ],

the same problem exists with != expression.

Objects not supported as expression

Dear buddy!

I get several errors for paint attributes. paint['fill-opacity'], line-width, fill-translate and etc. do they affect the shrink process? I'd appreciate if you add support for them (even with simply ignoring them if they aren't effective in the process)

Thanks a lot

Support filter comparison with number

Many editors of Mapbox Styles do not care about a difference between number and string for the filters.

So in many style.json there is the following in the filter expression

["==", "layer", 2]

When running filter on such a style one received the error Parsing mapbox style failed: Error in $.layers[X]: Comparing unequal things: Fix (UStr "layer"), Fix (UNum 2.0): Stringvs. Number

As far as I know the styles the number should always be treated as a string here.
It would be amazing to see this being supported.

"to-number" expression support

Dear Ondrej,

I have some filters with to-number expression as follows:

      "filter": [
        "all",
        [
          "==",
          [
            "to-number",
            [
              "get",
              "admin_level"
            ]
          ],
          2
        ],
        [
          "!=",
          [
            "to-number",
            [
              "get",
              "maritime"
            ]
          ],
          1
        ],
        [
          "!=",
          [
            "to-number",
            [
              "get",
              "disputed"
            ]
          ],
          1
        ]
      ],

I'll be so thankful if you add support for it too. ^_^ ๐Ÿ™

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.