You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
2.4 KiB

<!DOCTYPE html>
<meta charset="utf-8">
<style>
path {
stroke: white;
stroke-width: 0.25px;
fill: grey;
}
</style>
<body>
<script src="https://d3js.org/d3.v7.min.js"></script>
<script src="https://unpkg.com/topojson@3"></script>
<script src="map_data3.js" charset="utf-8"></script>
<script>
var width = 960,
height = 500;
var projection = d3.geoEquirectangular()
//.center([-64.7799734332998,32.3072000581802])
//.scale(70000)
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
var path = d3.geoPath()
.projection(projection);
var g = svg.append("g");
// load and display the World
//d3.json("world-110m2.json").then(function(topology) {
// const new_map = map_json.features.filter((feature, index)=>{
//return feature.properties.name != 'Argentina' && feature.properties.name != 'Angola'
//return feature.properties.name == 'Angola'
//return true
//return index != 21
// })
// for(feature of new_map){
// console.log(feature.properties.name);
// }
/*
const new_map = map_json.features.map((feature)=>{
if(feature.properties.name == 'Bermuda'){
//console.log(feature.geometry.coordinates[0].length);
//feature.geometry.coordinates = []
/*console.log(feature.geometry.coordinates[0][33]);
console.log(feature.geometry.coordinates[0][34]);
console.log(feature.geometry.coordinates[0][35]);
const updated_coords = feature.geometry.coordinates[0].filter((coord, index)=>{
return index < 34
})
feature.geometry.coordinates[0] = updated_coords;
feature.geometry.coordinates[0].splice(30, 16)
feature.geometry.coordinates[0] = feature.geometry.coordinates[0].filter((coord, index)=>{
if(
index == 30 ||
index == 31 ||
index == 32 ||
index == 33 ||
index == 34 ||
index == 35 ||
index == 36 ||
index == 37 ||
index == 38 ||
index == 39 ||
index == 40 ||
index == 41 ||
index == 42 ||
index == 43 ||
index == 44 ||
index == 45
){
return true
} else {
return true
}
})
//console.log(feature.geometry.coordinates[0]);
return feature
} else {
return feature
}
})*/
g.selectAll("path")
//.data(topojson.feature(topology, topology.objects.countries).features)
.data(map_json.features)
.enter().append("path")
.attr("d", path);
//});
</script>
</body>
</html>