How convert a genuine UK shapefile(other than the one from natural earth) to d3/topoj

المشرف العام

Administrator
طاقم الإدارة
I am following Mike's page (http://bost.ocks.org/mike/map/) to make UK's map. I've converted Mr. Crone's UK postcode shapefile into topojson but failed to display it correctly.

http://www.sharegeo.ac.uk/handle/10672/51?show=full

ogr2ogr -f GeoJSON postcodes.json gb_pca_2010.shptopojson -o uk.json --id-property Label postcodes.jsonThe resulting json is of 2.2M big. I have used the following code to display it

var height, svg, width;width = 960;height = 1160;svg = d3.select("body").append("svg").attr("width", width).attr("height", height);d3.json("uk.json", function(error, uk) { var projection, subunits; if (error) { return console.error(error); } subunits = topojson.feature(uk, uk.objects.postcodes); projection = d3.geo.mercator().translate([width / 2, height / 2]); return svg.append("path").datum(subunits).attr("d", d3.geo.path().projection(projection));});The result is that firefox freezes and in the end, I get half black and half white display. :( I have also tried mapshaper to simplify it to 1MB but still not working.

What else I could have tried?



أكثر...
 
أعلى