-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathc.js
More file actions
executable file
·36 lines (27 loc) · 1.02 KB
/
Copy pathc.js
File metadata and controls
executable file
·36 lines (27 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
var width = $("svg").width();
var height = $("svg").height();
var colors = ["#FD8110", "#26A625", "#D22829", "#9166C3", "#895844", "#E277C8", "#7E7E7E"];
var projection = d3.geo.mercator()
.scale(250)
.center([-60, -20])
.translate([width / 2, height / 2]);
var path = d3.geo.path()
.projection(projection);
d3.json("world-110m.json", function(error, world) {
if (error) return console.error(error);
d3.selectAll("svg").append("path")
.datum(topojson.feature(world, world.objects.countries))
.attr("d", path);
});
var svg = d3.select("svg");
var query = 'id:* AND location2_s:*';
var url = "http://localhost:8983/solr/jobposts/select?q=" + encodeURIComponent(query) + "&rows=50000&fl=longitude_d%2C+latitude_d&wt=json";
d3.json(url, function(error, resp) {
if (error) return console.error(error);
resp.response.docs.forEach(function(loc) {
svg.append("circle")
.attr("r", 1.2)
.attr("transform", "translate(" + projection([loc.longitude_d, loc.latitude_d]) + ")")
.style("fill", colors[6]);
});
});