D3 + OpenLayers 3 for Canadian Polling Districts
✓ Published0🌍 Public
BBrideau
Last edited Dec 4, 2015
Created on Dec 4, 2015
This example combines D3 and OpenLayers 3 to render Canadian polling district boundaries from a TopoJSON file onto a Stamen watercolor tile map. It uses a custom OpenLayers `ol.source.ImageCanvas` with a `canvasFunction` to draw the districts via `d3.geo.path` and a Mercator projection. The code transforms geographic bounds between EPSG:4326 and EPSG:3857, calculates scale and translation to align the D3-rendered vector features with the map’s current view. Election district polygons display names, province codes, and census population data from the JSON source.
AI-generated descriptionD3 + OpenLayers 3 for Canadian Polling Districts.
Adapted from OpenLayers 3 D3 Integration Example