Skip to content

Instantly share code, notes, and snippets.

View jaronimoe's full-sized avatar

Johannes Sorger jaronimoe

View GitHub Profile
@jaronimoe
jaronimoe / app.js
Last active September 12, 2019 12:55
deck.gl geojson update color on hover test
import React, {Component} from 'react';
import {render} from 'react-dom';
import {StaticMap} from 'react-map-gl';
import DeckGL, {GeoJsonLayer, PolygonLayer} from 'deck.gl';
import {LightingEffect, AmbientLight, _SunLight as SunLight} from '@deck.gl/core';
import {scaleThreshold} from 'd3-scale';
import {getJSONData} from './data_loader'
// Set your mapbox token here
const MAPBOX_TOKEN = process.env.MapboxAccessToken; // eslint-disable-line
@jaronimoe
jaronimoe / README.md
Last active January 25, 2018 16:05
d3.js v4 & leaflet v1.3 - drawing arbitrary SVGs

this example shows how to draw arbitrary SVGs (in this case circles) with d3 on a leaflet map.

the code can be seen as an extension to Mike Bostock's tutorial on drawing geoJSON shapes within leaflet with d3: https://bost.ocks.org/mike/leaflet/ - and as an update to similar older examples that rely on outdated leaflet versions.

these are the basic steps:

  1. create an svg within the leaflet overlay pane:

     //this svg holds the d3 visualizations
    

svg = d3.select(mymap.getPanes().overlayPane).append("svg");