viewof map8 = {
const [xMin, yMin, xMax, yMax] = cantonsBbox
const WIDTH = width
const HEIGHT = width * ((yMax - yMin) / (xMax - xMin))
const container = DOM.svg(WIDTH, HEIGHT)
const projectX = x => (x - xMin) / (xMax - xMin) * WIDTH
const projectY = y => HEIGHT - (y - yMin) / (yMax - yMin) * HEIGHT
const projection = d3.geoTransform({
point: function(x, y) {
this.stream.point(projectX(x), projectY(y))
}
})
const pathCreator = d3.geoPath().projection(projection)
const svg = d3.select(container)
svg.selectAll('path')
.data(cantons.features)
.enter()
.append('path')
.attr('d', pathCreator)
const yverdon = [2539070, 1181442]
const yverdonX = projectX(yverdon[0])
const yverdonY = projectY(yverdon[1])
svg.append('circle')
.attr('cx', yverdonX)
.attr('cy', yverdonY)
.attr('r', 10)
.attr('fill', 'red')
return container
}