Skip to content

Instantly share code, notes, and snippets.

@gati
Created September 7, 2014 16:53
Show Gist options
  • Save gati/0ddab8655ae64f8bc454 to your computer and use it in GitHub Desktop.
Save gati/0ddab8655ae64f8bc454 to your computer and use it in GitHub Desktop.
Visualize lat/lon points
<!doctype html>
<html>
<head></head>
<body>
<!--
Obviously this is not production code. Really I was just rendering a map so I could take a screenshot and post it on Twitter,
and this was faster than using some Python mapping library (and looks way nicer!). So no judgement, mkay?
This plots points taken from my Google Location data, formatted using this handy Python script:
https://gist.github.com/gati/400f462a6fff00448dad
-->
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/topojson.v1.min.js"></script>
<script src="https://raw.githubusercontent.com/markmarkoh/datamaps/master/dist/datamaps.world.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="container" style="position: relative; width: 1000px; height: 600px;"></div>
<script>
var map = new Datamap({
element: document.getElementById('container'),
fills: {
'fill': '#1f77b4',
defaultFill: '#ddd'
}
});
$.ajax({
url: "data/fixed_this_year.json",
mimeType: "application/json"
}).done(function(data) {
for(var i in data) {
data[i].radius = 6;
data[i].yeild = 100;
data[i].fillKey = 'fill';
data[i].borderWidth = 0;
}
map.bubbles(data);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment