map = {
const width = 800;
const height = 400;
const svg = d3.create("svg")
.attr("width", width)
.attr("height", height);
const projection = d3.geoMercator()
.translate([width / 2, height / 1.8]);
const path = d3.geoPath().projection(projection);
d3.json("https://cdn.jsdelivr.net/npm/world-atlas@2/countries-110m.json").then(worldData => {
const countries = topojson.feature(worldData, worldData.objects.countries);
const filteredFeatures = countries.features.filter(d =>
d.properties.name !== "Antarctica" && d.id !== "ATA"
);
const filteredCountries = {
type: "FeatureCollection",
features: filteredFeatures
};
projection.fitSize([width, height], filteredCountries);
svg.selectAll("path")
.data(filteredCountries.features)
.enter()
.append("path")
.attr("d", path)
.attr("class", "country");
});
return svg.node()
}