mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-02-23 18:14:19 -08:00
Working with NM
This commit is contained in:
parent
722e45ce9d
commit
ac3d43326f
1 changed files with 15 additions and 8 deletions
|
@ -125,8 +125,9 @@ const MapWrapper = ({features}: IMapWrapperProps) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const j40source = new VectorTileSource({
|
const j40source = new VectorTileSource({
|
||||||
format: new MVT(),
|
'format': new MVT(),
|
||||||
url: 'http://localhost:8080/data/block2010/{z}/{x}/{y}.pbf',
|
'url': 'http://localhost:8080/data/block2010/{z}/{x}/{y}.pbf',
|
||||||
|
// url: 'http://usds-geoplatform-justice40-website.s3-website-us-east-1.amazonaws.com/tiles/{z}/{x}/{y}.pbf',
|
||||||
});
|
});
|
||||||
|
|
||||||
const colors = d3.scaleSequential(d3.interpolateBlues)
|
const colors = d3.scaleSequential(d3.interpolateBlues)
|
||||||
|
@ -137,15 +138,21 @@ const MapWrapper = ({features}: IMapWrapperProps) => {
|
||||||
source: j40source,
|
source: j40source,
|
||||||
style: function(feature) {
|
style: function(feature) {
|
||||||
const data = feature.get('score_a_percentile');
|
const data = feature.get('score_a_percentile');
|
||||||
|
let colorString;
|
||||||
|
if (data) {
|
||||||
const rgb = colors(data);
|
const rgb = colors(data);
|
||||||
const rbgArr = rgb.slice(
|
const rbgArr = rgb.slice(
|
||||||
rgb.indexOf('(') + 1,
|
rgb.indexOf('(') + 1,
|
||||||
rgb.indexOf(')'),
|
rgb.indexOf(')'),
|
||||||
).split(', ');
|
).split(', ');
|
||||||
|
colorString = `rgba(${rbgArr[0]}, ${rbgArr[1]}, ${rbgArr[2]}, 0.5)`;
|
||||||
|
} else {
|
||||||
|
colorString = 'white';
|
||||||
|
}
|
||||||
// const inOrOut = feature.get('score_a_top_percentile_25');
|
// const inOrOut = feature.get('score_a_top_percentile_25');
|
||||||
return new Style({
|
return new Style({
|
||||||
fill: new Fill({
|
fill: new Fill({
|
||||||
color: `rgba(${rbgArr[0]}, ${rbgArr[1]}, ${rbgArr[2]}, 0.5)`, // inOrOut == 'True' ? 'blue' : 'white',
|
color: colorString, // inOrOut == 'True' ? 'blue' : 'white',
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue