Git Product home page Git Product logo

feature-filter's Introduction

feature-filter's People

Contributors

camilleanne avatar jfirebaugh avatar mourner avatar peckjon avatar scothis avatar tmcw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

feature-filter's Issues

support for regex pattern match

It is very useful in many cases, providing capabilities to filter features by regex matching.

e.g.

// will match a feature whose prop0 matches pattern.
var filter = ['match', 'prop0', 'pattern'];

Nested properties

I can't find anything about support for nested properties in the GL spec so I'm just curious if it's something you'd like to support.

Since a GeoJSON properties object can be any JSON I'd expect to be able to filter on nested properties as well.

Maybe something that would work like this?:

featureFilter([
  'all', [
    '>=', 'duration.min', 500,
    '<=', 'duration.max', 1000
  ]
])({
properties: {
  duration: {
    min: 530,
    max: 800
  }
}); // = true!

I realise the issue is possible conflicts with a key named duration.max in this case so maybe use a "magic key" similar to $type?

Obviously another solution to this would be to flatten the properties JSON using something like https://github.com/hughsk/flat but sometimes that's not an option.

Cheers!

Lazily compile filters

Compiling a filter using new Function is computationally expensive. Lazily compiling filters avoids any cost for filters that never get used.

Handle filters like [ "==" , key, "*"]

Steps to Trigger Behavior

Create a filter spec like so:
[ '==', 'highway', '*']

This sort of <key>=* spec is pretty common in OSM.


Expected Behavior

Filters all features that have the highway tag, irrespective of the value. So features having a highway=primary, highway=secondary, highway=residential or highway=<anything> would get filtered.


Actual Behaviour

They don't get filtered.

Support filtering tiles from geojson-vt

For whatever reason geojson-vt generates vector tiles with geojson properties mapped to the tags property. This module used to check for f.tags and it is still mentioned in the code comments but it was removed: #12 (comment) - looks like nobody could remember why it was there. It would be good to support filtering tiles generated by geojson-vt, either by changing geojson-vt to use properties (which would also require changes to vt-pbf) or changing this back to check f.tags 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.