Reputation: 21
I have followed all several instructions on the internet but not results for a while now , i would like to explore D3 for choropleth maps, the topojson being generated cannot be rendered in the browser using d3 am stack at this point,
so far , i have downloaded and installed ogr2ogr , Nodejs
the commands am running to generate the topo json are
ogr2ogr -f GeoJSON -s_srs EPSG:4199 -t_srs EPSG:4199 districts.json "uganda distriscts.shp"
followed by
topojson --id-property district_i -p district=DIST_2010 -p AREA -p HECTAREAS -o ug.json districts.json
Am totally New to D3 and TopoJSON and Not a GIS expert either. Please help me get over this huddle attached are the shapefiles i would like to generate topojson and render this on a choropleth map using d3 . i will be glad if any one could provide me with pointers on how to generate the correct topojson formats for uganda since most examples are with USA and other regions. your help will be highly appreciated
Upvotes: 2
Views: 2558
Reputation: 237
First - what is "uganda distriscts.shp"
? Why you have space in filename and quotes in command. You should have all files without spaces like uganda_distriscts.shp
or ugandaDistriscts.shp
, and no need in quotes!
Second - You should convert your map to WGS84 like so:
ogr2ogr -f GeoJSON -s_srs uganda_distriscts.prj -t_srs EPSG:4326 uganda_distriscts_wgs84.json uganda_distriscts.shp
Here uganda_distriscts.prj
is projection file you should have, maybe it has another name, so look in folder for file with extension .prj
.
Next you should create TopoJSON file like this:
topojson -o ug.json --id-property district_i -p district=DIST_2010 -p AREA -p HECTAREAS uganda=uganda_distriscts_wgs84.json
And examine this thread Map with d3.js and TopoJSON, Albers Siberia projection. I hope this will help you.
Upvotes: 2