Built with blockbuilder.org
Last active
March 15, 2018 02:30
-
-
Save smokbel/5bd4d590a410e9cb9ef438a091773777 to your computer and use it in GitHub Desktop.
ont-map
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| license: mit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <h1>Ontario subdivision map</h1> | |
| <script src="https://d3js.org/d3.v4.min.js"></script> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/topojson/3.0.2/topojson.js"></script> | |
| <style> | |
| #ont { | |
| fill: lightGrey; | |
| stroke: grey; | |
| } | |
| </style> | |
| <body> | |
| <div id="map"></div> | |
| <script> | |
| var width = 960, height = 700; | |
| var svg = d3.select('#map').append('svg') | |
| .attr('width', width) | |
| .attr('height', height) | |
| d3.json('ont.json', function(error, CensusSubDiv) { | |
| if (error) return console.error(error); | |
| var featureCollection = topojson.feature(CensusSubDiv, CensusSubDiv.objects.CensusSubDivision) | |
| var projection = d3.geoIdentity() | |
| .reflectY(true) | |
| .fitSize([width,height],featureCollection) | |
| svg.append('path') | |
| .datum(featureCollection) | |
| .attr('d', d3.geoPath().projection(projection)) | |
| .attr('id', 'ont'); | |
| }); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment