javascript - Parsing error when drawing SVG paths from GeoJSON -


i made world map d3.js. worked charm. used same code different geojson file, depicting sweden only, , got multiple parsing errors. both json files have same structure, well-formatted , on. difference coordinates, i'm suspecting that's problem lies. ideas?

i'm using qgis convert shapefiles geojson format. error i'm getting is: "error: problem parsing d='[the path string]'". , path string contains nan here , there.

sweden.json excerpt:

{ "type": "feature", "id": 0, "properties": {     "knkod": "0114",     "knnamn": "upplands väsby",     "landareakm": 75.4 }, "geometry": {     "type": "polygon",     "coordinates": [         [             [                 1620218.000425555,                 6599561.998826771             ],... 

countries.json excerpt

{ "type": "feature", "id": 0, "properties": {     "type": "country",     "name": "aruba" }, "geometry": {     "type": "polygon",     "coordinates": [         [             [                 -69.89912109375,                 12.452001953124991             ],... 

javascript

var canvas = d3.select("body").append("svg")     .attr("width", 960)     .attr("height", 1000)  d3.json("sweden/countries.geojson", function (data) {  var group = canvas.selectall("g")     .data(data.features)     .enter()     .append("g")  var path = d3.geo.path().projection(d3.geo.mercator());  var areas = group.append("path")     .attr("d", path) }) 

your geojson files aren't in same coordinate system. coordinates sweden they're in utm. when converting geojson qgis, make sure you're using same coordinate system sweden did world file -- should fix error.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -