circles = {
const coordinates = [];
const appendCircles = (extent, stepping) => {
const [[xMin, yMin], [xMax, yMax]] = extent;
const [stepX, stepY] = stepping;
const circle = d3.geoCircle()
.center(d => d)
.radius(2.5)
.precision(10);
let yStart = 0;
while (yStart < yMin) {
yStart += stepY;
}
let xStart = 0;
while (xStart < xMin) {
xStart += stepX;
}
for (let y = yStart; y <= yMax; y += stepY) {
for (let x = xStart; x <= xMax; x += stepX) {
coordinates.push(circle([x, y]).coordinates);
}
}
yStart = 0 - stepY;
while (yStart > yMax) {
yStart -= stepY;
}
xStart = 0;
while (xStart < xMin) {
xStart += stepX;
}
for (let y = yStart; y >= yMin; y -= stepY) {
for (let x = xStart; x <= xMax; x += stepX) {
coordinates.push(circle([x, y]).coordinates);
}
}
yStart = 0;
while (yStart > yMax) {
yStart -= stepY;
}
xStart = 0 - stepX;
while (xStart > xMax) {
xStart -= stepX;
}
for (let y = yStart; y >= yMin; y -= stepY) {
for (let x = xStart; x >= xMin; x -= stepX) {
coordinates.push(circle([x, y]).coordinates);
}
}
yStart = 0 + stepY;
while (yStart < yMin) {
yStart += stepY;
}
xStart = 0 - stepX;
while (xStart > xMax) {
xStart -= stepX;
}
for (let y = yStart; y <= yMax; y += stepY) {
for (let x = xStart; x >= xMin; x -= stepX) {
coordinates.push(circle([x, y]).coordinates);
}
}
}
if (localDistortions.minorCrossings) {
appendCircles(minorExtentTargets, minorStepTargets);
}
if (localDistortions.majorCrossings) {
appendCircles(majorExtentTargets, majorStepTargets);
}
return {type: "MultiPolygon", coordinates};
}