Last active
May 31, 2018 23:08
-
-
Save seasmith/761b1c1f634d27dd4f740df7d87bb591 to your computer and use it in GitHub Desktop.
Testing sf data converted to geojson
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: mit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
h1, h2 { | |
font-family: "Lato", "Open Sans", "sans-serif"; | |
margin: 0px; | |
padding: 3px; | |
} | |
.text-things { | |
margin-bottom: 8px; | |
} | |
.tract { stroke: rgb(88, 88, 88)} | |
.tract:hover { opacity: 0.5; transition-delay: 500ms;} | |
</style> | |
<div class="text-things"> | |
<h1>Testing sf data converted to geojson</h1> | |
</div> | |
<svg width="960" height="550"></svg> | |
<script src="https://d3js.org/d3.v4.min.js"></script> | |
<script src="d3-tip.js"></script> | |
<script> | |
var svg = d3.select("svg"), | |
margin = { top: 20, bottom:20, right: 20, left: 20}, | |
width = +svg.attr("width"), | |
height = +svg.attr("height"); | |
d3.queue() | |
.defer(d3.json, "rig_counts.json") | |
.await(ready); | |
function ready(error, data) { | |
if (error) throw error; | |
var path = d3.geoPath() | |
.projection(d3.geoAlbers() | |
.fitExtent([[margin.left, margin.top], [width-margin.right, height-margin.bottom]], data) | |
); | |
svg.selectAll("path") | |
.data(data.features) | |
.enter().append("path") | |
.attr("class", "tract") | |
.attr("d", path); | |
}; | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "v1", | |
"config": { | |
"visState": { | |
"filters": [], | |
"layers": [ | |
{ | |
"id": "14g27b", | |
"type": "geojson", | |
"config": { | |
"dataId": "dufrudp5f", | |
"label": "rig_counts", | |
"color": [ | |
241, | |
92, | |
23, | |
255 | |
], | |
"columns": { | |
"geojson": "_geojson" | |
}, | |
"isVisible": true, | |
"visConfig": { | |
"opacity": 0.8, | |
"thickness": 2, | |
"colorRange": { | |
"name": "Global Warming", | |
"type": "sequential", | |
"category": "Uber", | |
"colors": [ | |
"#5A1846", | |
"#900C3F", | |
"#C70039", | |
"#E3611C", | |
"#F1920E", | |
"#FFC300" | |
], | |
"reversed": false | |
}, | |
"radius": 10, | |
"sizeRange": [ | |
0, | |
10 | |
], | |
"radiusRange": [ | |
0, | |
50 | |
], | |
"heightRange": [ | |
0, | |
500 | |
], | |
"elevationScale": 5, | |
"hi-precision": false, | |
"stroked": true, | |
"filled": true, | |
"enable3d": false, | |
"wireframe": false | |
} | |
}, | |
"visualChannels": { | |
"colorField": { | |
"name": "RigCount", | |
"type": "string" | |
}, | |
"colorScale": "ordinal", | |
"sizeField": null, | |
"sizeScale": "linear", | |
"heightField": null, | |
"heightScale": "linear", | |
"radiusField": null, | |
"radiusScale": "linear" | |
} | |
} | |
], | |
"interactionConfig": { | |
"tooltip": { | |
"fieldsToShow": { | |
"dufrudp5f": [ | |
"state", | |
"county", | |
"RigCount" | |
] | |
}, | |
"enabled": true | |
}, | |
"brush": { | |
"size": 0.5, | |
"enabled": false | |
} | |
}, | |
"layerBlending": "normal", | |
"splitMaps": [] | |
}, | |
"mapState": { | |
"bearing": 0, | |
"dragRotate": false, | |
"latitude": 51.276070716001534, | |
"longitude": -114.52992426446124, | |
"pitch": 0, | |
"zoom": 2.759672619963176, | |
"isSplit": false | |
}, | |
"mapStyle": { | |
"styleType": "dark", | |
"topLayerGroups": {}, | |
"visibleLayerGroups": { | |
"label": true, | |
"road": true, | |
"border": false, | |
"building": true, | |
"water": true, | |
"land": true | |
}, | |
"mapStyles": {} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment