Map is not displaying after uploading to website

19 views
Skip to first unread message

Qutab Alam

unread,
Jul 21, 2016, 2:56:12 AM7/21/16
to d3-js
Dear All

I am working on map, it is working on my local computer but when I uploaded it is giving me error, 
Unexpected end of JSON input(…)(anonymous function) 

below is the code:

var projection = d3.geo.mercator()
.scale(1)
.translate([0, 0]);

vis.path = d3.geo.path()
.projection(projection);


d3.json("data/southsudan.json", function (error, data) {
if(error) console.error(error);

console.log(data);
var southSudan = data.features;
var b = vis.path.bounds(data),
s = .95 / Math.max((b[1][0] - b[0][0]) / vis.width, (b[1][1] - b[0][1]) / 400),
t = [( vis.width - s * (b[1][0] + b[0][0])) / 2, (400 - s * (b[1][1] + b[0][1])) / 2];

projection.scale(s)
.translate(t);

var div = d3.select("body").append("div")
.attr("class", "tooltip")
.style("opacity", 0);

vis.svg.selectAll("path.map-country")
.data(southSudan)
.enter()
.append('path')
.attr('d', vis.path)

Please if some body can help me with this.

best regards
Qutab
Reply all
Reply to author
Forward
0 new messages