mapbox / geojson-vt

Slice GeoJSON into vector tiles on the fly in the browser
ISC License
1.88k stars 270 forks source link

Enable crossfilter filtering #82

Closed chplog closed 7 years ago

chplog commented 7 years ago

Thank you for your great work! I'm wondering, if it's possible to apply crossfilter instance as a Feature collection to geojson-vt. I've tried to implement something in the drawingOnCanvas() function in the example, however, it seems, that it should be integratet deeper in the library. What do you think?

jfirebaugh commented 7 years ago

By crossfilter, are you referring to http://square.github.io/crossfilter/?

chplog commented 7 years ago

Yes. Sorry for not being clear. As a workaround i remove the layer and add it again with the new filtered features. Here is a nice example: http://adilmoujahid.com/posts/2016/08/interactive-data-visualization-geospatial-d3-dc-leaflet-python/

However, i assume it's going to be slow on a big dataset...

mourner commented 7 years ago

I've tried to implement something in the drawingOnCanvas() function in the example, however, it seems, that it should be integratet deeper in the library.

Since GeoJSON-VT slices and simplifies the data so that it could be small enough for rendering fast, as a result, for any particular view, the data should be fast enough to filter linearly (e.g. by looping through all features) rather than indexing with something like crossfilter. Would that work for your case? I don't think we could integrate it in geojson-vt easily.

chplog commented 7 years ago

After playing around with several approaches I admit that your're right, mourner. Filtering does the job very well. Thank you!

mourner commented 7 years ago

Glad to hear that, thanks!