Uncaught ReferenceError: projection is not defined -
i trying load geojson file .html giving me "uncaught referenceerror: projection not defined"
my code:
<!doctype html> <html> <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js" charset="utf-8"></script> <style type="text/css"> </style> </head> <body> <script> var canvas=d3.select("body").append("svg") .attr("width", 760) .attr("height", 700) d3.json("sweden20.geojson", function(data) { var group= canvas.selectall("g") .data(data.features) .enter() .append("g") var pojection = d3.geo.mercator(); var path = d3.geo.path().projection(projection); var areas= group.append("path") .attr("d", path) .attr("class", "area") .attr("fill", "steelblue"); }); </script> </body> </html>
and sweden20.geojson taken sweden in here:http://code.highcharts.com/mapdata/
there probable typo in line:
var pojection = d3.geo.mercator();
replace pojection
projection
, reference error should go away.
Comments
Post a Comment