D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
ngocbien
Full window
Github gist
Carte de Paris
Built with
blockbuilder.org
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>D3: Setting path fills</title> <script src="https://d3js.org/d3.v4.min.js"></script> <style type="text/css"> /* No style rules here yet */ </style> </head> <body> <script type="text/javascript"> /* */ //Width and height var w = 1280; var h = 720; //Define map projection var projection = d3.geoConicConformal() .center([2.5,48.65]) .scale(20000); //Define path generator var path = d3.geoPath() .projection(projection); //Create SVG element var svg = d3.select("body") .append("svg") .attr("width", w) .attr("height", h); //Load in GeoJSON data d3.json("arrondissements-ile-de-france.geojson", function(json) { //Bind data and create one path per GeoJSON feature svg.selectAll("path") .data(json.features) .enter() .append("path") .attr("d", path) .style("fill", "steelblue"); }); </script> </body> </html>
https://d3js.org/d3.v4.min.js