RFC: Style Classifier
See original GitHub issueTarget Use case
Allow an easy way to style tile layers using tilestats.
If you need to style a TileLayer and you don’t have access to all the data, you need to use stats to style the layer.
Related with: https://github.com/visgl/deck.gl/issues/4930
Proposed feature
This RFC proposes the creation of a new utility class Classifier, to ease the styling of the layer’s features, by working with its stats.
Having a way to create more easily styles for a layer could be achieved, by having a class to compute bins with different classification methods. Those bins could be used inside style functions returning colors or sizes, such as getFillColor
. That class should be fed with metadata coming from the layer’s source (or entered by the user).
Usage example:
const colors = [
[0, 0, 0, 0],
[0, 255, 0, 0],
[255, 0, 255, 0]
];
let classifier;
const layer = new MVTLayer({
getFillColor: (f) => {
const bin = classifier.getBin(f.population);
return colors[bin];
},
onMetadata: (tilejson) => {
const layerStats = tilejson.tilestats.layers[0];
classifier = new Classifier({
layerStats, // it could be eg. this.state.metadata.tilestats.layer[0]
attribute: 'revenue',
method: 'quantiles',
bins: 3
});
}
});
Classifier params:
- layerStats : stats for the layer. The structure is defined by a layer item at the layers array of Mapbox tilestats.
- attribute: attribute you want to use for the classifier
- method: ‘quantiles’, ‘equal’, ‘jenk’, ‘stdev’,
- bins: number of bins.
To Do List
- Add label and assign to milestone
- Coding
- Doc update
- What’s new update
- Test
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
RFC 8819 - YANG Module Tags - IETF Datatracker
YANG Module Tags (RFC 8819) ... This document defines IETF tags to support the classification style described in [RFC8199]. 6. Guidelines to Model...
Read more >Random Forest Classifier for Bioinformatics | Analytics Vidhya
As a result, RFC is one of the top choices for classification among bioinformaticians. Further, RFC performs well in cases where the sample ......
Read more >Style Guide - » RFC Editor
The following documents form the RFC Style Guide. ... Abbreviations List – Expansions of abbreviations (and acronyms) in RFCs; Terms List – Table...
Read more >Mushroom Classification : 100 % accuracy with RFC - Kaggle
#for visualization purpose and pre-processing import pandas as pd import numpy as np import matplotlib.pyplot as plt from matplotlib import style import ...
Read more >Deep multi-task learning and random forest for series ... - NCBI
Overall RFC sequence classification accuracy was 97% with ... Paszke A, Gross S, Massa F, et al (2019) PyTorch: an imperative style, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The main issue is that there is no clear standard in the industry for tile stats. The closest option for a standard I know is Mapbox Tilestats. So I agree 100% it’s no so direct as TileJSON.
Why I consider it could be in deck.gl?
There is no easy and common solution to style layers using bins. And it’s a very common styling feature. This problem gets more complicated with tile layers where the user has no access to the full data.
If someone needs to visualize a large layer, a very common solution is to “tilefy” the layer (and it will probably use Tippecanoe or a tool which uses Tippecanoe under the hood), so they already have this format of stats.
You can use that for other layers too. You can calculate the stats in a GeoJSON layer and after that, you have an easy way for styling.
If we would have a tile stats standard it’d be pretty obvious, but as it’s not there we have the following options: a) Move forward with something is not 100% standard but a common use case for the users. b) Try to push around the standard to include tile stats at TileJSON. c) a + b.
To be honest, after @kylebarron I’m not 100% sure what it’s the best option. Thoughts?
Replaced by #5222