Published
Edited
Jun 4, 2021
1 fork
Importers
7 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
proj2154 = proj4('EPSG:2154')
Insert cell
Insert cell
proj2154.forward([2.333333, 48.866667]) // Paris est dans ce système à 6 863 km au nord de l'équateur
Insert cell
Insert cell
proj2154.inverse([651094.1791034087, 6863166.147061145]) // je retombe à peu près sur mes pieds !
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
proj_epsg2154 = proj4d3(2154)
Insert cell
Insert cell
proj_e4326_to_map_e2154 = proj_epsg2154.fitExtent(map_extent, a_dep)
Insert cell
Insert cell
{
const context = DOM.context2d(size.width, size.height)
const path2154 = d3.geoPath(proj_e4326_to_map_e2154, context)
context.strokeStyle = '#ccc'
context.fillStyle = '#FEEDAB'
a_dep.features.forEach( d => path2154(d) )
context.fill()
context.stroke()
return context.canvas
}
Insert cell
Insert cell
Insert cell
Insert cell
{
const svg = d3.create("svg")
.attr("viewBox", [0, 0, size.width, size.height])
.attr("width", size.width)
.attr("height", size.height)
const path2154 = d3.geoPath(proj_e4326_to_map_e2154)
let paths = svg.selectAll('path')
.data(a_dep.features)
.join('path')
.attr('d', path2154)
.attr("fill", '#FEEDAB')
. attr("stroke", '#CCC')
return svg.node()
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
const context = DOM.context2d(size.width, size.height)
const path2154 = d3.geoPath(proj_e4326_to_map_e2154, context)
// départements
context.strokeStyle = '#ccc'
a_dep.features.forEach( d => {
context.fillStyle = reg_color_map.get(d.properties.reg)
context.beginPath()
path2154(d)
context.fill()
})
context.stroke()
// contour France
context.strokeStyle = 'black'
context.beginPath()
path2154(l_fra)
context.stroke()
return context.canvas
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more