简体   繁体   中英

Is there any possibilities to realize multi-filter on WebGlPointsLayer

I'm using React, OpenLayers & https://tileserver.readthedocs.io/en/latest/index.html to take src for my WebGlPointLayer. I've got a lot of data to display on the highest zoom. Now I'm going to create some filters, so following OpenLayers example ( https://openlayers.org/en/latest/examples/filter-points-webgl.html ) I've done the same for my porject. The problem is the multiple filters realization. Filter is done by style.variables and style.filter.

{
    variables: defaultVariables,
    filter: ['between', ['get', 'i'], ['var', 'volumeMnemonicsFrom'], ['var', 'volumeMnemonicsTo']],
    symbol: {
      symbolType: 'circle',
      size: [10, 10],
      color,
      rotateWithView: false,
      offset: [0, 0],
    },
  }

Is there any possibilities to realize multiple filters by WebGLPointsLayer style property?

what you need to do is simply using 'all' expression and putting all filter definitions as parameter of it. Something like this:

  filter: ['all', 
    ['between', ['get', 'i'], ['var', 'volumeMnemonicsFrom'], ['var', 'volumeMnemonicsTo']],
    ['between', ['get', 'anotherFilterField'], ['var', 'minAnotherFilterField'], ['var', 'maxAnotherFilterField']],
  ],

you can check the source code of expressions here. It's a pity the all value is missing in the original example of the WebGlPointsLayer in the openlayers page .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM