baseMapSVG = {
const svg = d3.create("svg").attr("viewBox", `0 0 ${baseWidth} ${baseHeight}`);
const entLayer = svg
.append("g")
.attr("id", "ent")
.append("path")
.attr("d", cached_ent_path)
.attr("fill", "#f5f5f5")
.attr("stroke", "#999")
.attr("stroke-width", 1.2);
const circlesLayer = svg
.append("g")
.attr("id", "all-fosas")
.selectAll("circle")
.data(mun_fosas)
.join("circle")
.attr("id", (d) => `${d.CVEGEO}-${d.ANIO}`)
.attr("class", (d) => `fosas-circle fosas-circle-${d.ANIO}`)
.attr("cx", (d) => projection(d.geometry.coordinates)[0])
.attr("cy", (d) => projection(d.geometry.coordinates)[1])
.attr("r", (d) => dotScale(d.rolling))
.attr("stroke", "#fff")
.attr("stroke-width", 0)
.attr("fill", (d) => yearScale(d.ANIO))
.attr("fill-opacity", 1)
.attr("data-cvegeo", (d) => d.CVEGEO);
const labelsLayer = svg
.append("g")
.attr("id", "ent-label")
.selectAll("text")
.data(ent.features)
.join("text")
.text((d) => {
const abbrev = ent_abbrev.get(d.properties.CVEGEO);
return abbrev ? abbrev : "";
})
.attr("id", d => `ent-cve-${d.properties.CVEGEO}`)
.attr("text-anchor", "middle")
.attr("x", (d) => path.centroid(d)[0])
.attr("y", (d) => path.centroid(d)[1])
.attr("stroke-width", 2)
.attr("fill", "#999")
.attr("stroke", "#fff")
.attr("paint-order", "stroke");
const tooltipsLayer = svg.append("g").attr("id", "tooltips");
const dotLegend = svg.append("g");
const dotY = 400;
const textOffset = 35;
const lineHeight = 25;
dotLegend
.append("circle")
.attr("r", dotScale(maxSum))
.attr("fill", "none")
.attr("stroke", "#999")
.attr("stroke-width", 1.5)
.attr("cx", dotScale(maxSum) + 1)
.attr("cy", dotY);
dotLegend
.append("circle")
.attr("r", dotScale(10))
.attr("fill", "none")
.attr("stroke", "#999")
.attr("stroke-width", 1.5)
.attr("cx", dotScale(maxSum) + 1)
.attr("cy", dotY + dotScale(maxSum) - dotScale(10));
dotLegend
.append("text")
.text("10 fosas")
.attr("x", dotScale(maxSum) * 2 + 5)
.attr("y", dotY + dotScale(maxSum))
.attr("text-anchor", "start")
.attr("class", "circle-legend-text")
dotLegend
.append("text")
.text(`${maxSum} fosas`)
.attr("x", dotScale(maxSum) * 2 + 5)
.attr("y", dotY - dotScale(maxSum) + 12)
.attr("text-anchor", "start")
.attr("class", "circle-legend-text")
dotLegend.append("text").text("El tamaño de cada punto")
.attr("x", 0)
.attr("y", dotY + dotScale(maxSum) + textOffset)
.attr("text-anchor", "start")
.attr("class", "circle-legend-note");
dotLegend.append("text").text("representa el número de")
.attr("x", 0)
.attr("y", dotY + dotScale(maxSum) + textOffset + lineHeight)
.attr("text-anchor", "start")
.attr("class", "circle-legend-note");
dotLegend.append("text").text("fosas clandestinas encontradas")
.attr("x", 0)
.attr("y", dotY + dotScale(maxSum) + textOffset + (lineHeight * 2))
.attr("text-anchor", "start")
.attr("class", "circle-legend-note");
dotLegend.append("text").text("en cada municipio.")
.attr("x", 0)
.attr("y", dotY + dotScale(maxSum) + textOffset + (lineHeight * 3))
.attr("text-anchor", "start")
.attr("class", "circle-legend-note");
const sourceLine = svg.append("g");
sourceLine.append("text").text("Fuente: Comisión Nacional de Búsqueda.")
.attr("x", baseWidth)
.attr("y", baseHeight - 28)
.attr("text-anchor", "end")
.attr("class", "map-sourceline");
sourceLine.append("text").text("Datos al 30 de abril, 2023.")
.attr("x", baseWidth)
.attr("y", baseHeight - 4)
.attr("text-anchor", "end")
.attr("class", "map-sourceline");
const logoWidth = 250;
const elabLogoAspect = .21875;
svg.append("svg:image")
.attr("xlink:href", d => elab_logo_color)
.attr("x", baseWidth - logoWidth)
.attr("y", 0)
.attr("width", logoWidth)
.attr("height", logoWidth * elabLogoAspect);
const adondeAspect = .45625;
svg.append("svg:image")
.attr("xlink:href", d => logoAdondevanlosdesaparecidos)
.attr("x", baseWidth - logoWidth)
.attr("y", 50)
.attr("width", logoWidth)
.attr("height", logoWidth * adondeAspect);
return svg.node();
}