blob: 5cd26346600f303e4ac9215f52e722ec98d47d15 [file] [log] [blame]
Paul Greyson6cb8ca02014-11-12 18:09:02 -08001see: http://bost.ocks.org/mike/map/
2
3brew install gdal
4npm install -g topojson
5
6To generate continental US map:
7
Paul Greysonfcba0e82014-11-13 10:21:16 -08008 $ wget 'http://www.naturalearthdata.com/download/50m/cultural/ne_50m_admin_1_states_provinces_lakes.zip'
9 $ unzip ne_50m_admin_1_states_provinces_lakes.zip
10 $ ogr2ogr -f GeoJSON -where "sr_adm0_a3 IN ('USA')" states.json ne_50m_admin_1_states_provinces_lakes.shp
Paul Greyson6cb8ca02014-11-12 18:09:02 -080011
12edit states.json to remove data for Hawaii and Alaska
13
Paul Greysonfcba0e82014-11-13 10:21:16 -080014 $ topojson states.json > topology.json
15
16
17The .shp file above is incomplete (USA and part of Candada.)
18So it may be that each region requires a bit of research to generate.
19Ideally a source for public domain shp files can be found that covers all geographic regions.
20
21
22For Canada:
23
24 # wget 'http://www12.statcan.gc.ca/census-recensement/2011/geo/bound-limit/files-fichiers/gpr_000b11a_e.zip'
25 # unzip gpr_000b11a_e.zip
26 # ogr2ogr -f "GeoJSON" -s_srs EPSG:21781 -t_srs EPSG:4326 canada.json gpr_000b11a_e.shp
27 # topojson --id-property CFSAUID -p name=PRNAME -p name canada.json > topology.json
28
29
30This produces a very large (5MB) file and draws very slowly in Chrome.
31So some additional processing is required to simplify the geometry. (It is not checked in.)
32
33Also, the specification of object structure within the geojson is unclear.
34In the US map the geojson structure is
35
36 json.objects.states
37
38but in the Canadian data it's
39
40 json.objects.canada
41
42
43Lastly, the projection that is used may be tailored to the region.
44The preferred projection for the US is "albers" and d3 provides a "albersUSA" which can be used to
45 project hawaii and alaska as well
46
47For Canada, apparantly a "Lambert" projection (called conicConformal in d3) is preferred
48
49see:
50 https://github.com/mbostock/d3/wiki/Geo-Projections
51 http://www.statcan.gc.ca/pub/92-195-x/2011001/other-autre/mapproj-projcarte/m-c-eng.htm
52
53
54Summary:
55- some additional work is required to fully generalize maps functionality.
56- it may be worthwhile for ON.LAB to provide the topo files for key regions since producing these
57 files is non-trivial
58
59
60
Paul Greyson6cb8ca02014-11-12 18:09:02 -080061