Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save outermeasure/6d0dd69cbacd407a217f3ab185234a0d to your computer and use it in GitHub Desktop.
Save outermeasure/6d0dd69cbacd407a217f3ab185234a0d to your computer and use it in GitHub Desktop.
const cellCoords = cells.map(
(cell) => [
{lat: cell.lat, lng: cell.long},
{lat: cell.lat + incrementlat, lng: cell.long},
{lat: cell.lat + incrementlat, lng: cell.long + incrementlong},
{lat: cell.lat, lng: cell.long + incrementlong},
]
);
const cellColors = cells.filter(cell => !isCost || cell.humidity > 80).map(
(cell) => {
let opacity = Math.abs(cell.humidity - (-999.0)) < 1e-6 ? 0.0 : 0.8;
let finalColor = lerp([244, 67, 54], [33, 150, 243], opacity * cell.humidity / 100.0).map(Math.floor);
return {
color: `rgb(${finalColor[0]}, ${finalColor[1]}, ${finalColor[2]})`,
opacity: opacity,
}
}
);
return <div
className={`map ${className}`}
ref={(div) => {
if (div) {
that._map = new googleLibraries.maps.Map(div, {
center: center,
zoom: zoom,...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment