main
Matt Huntington 3 years ago
parent 4f98164013
commit 7d671f2934

@ -9,7 +9,7 @@ var worldProjection = d3.geoEquirectangular();
d3.select('svg').selectAll('path') d3.select('svg').selectAll('path')
.data(map_json.features) .data(map_json.features)
.enter() .enter()
.append('path') .append('path')
.attr('fill', '#099'); .attr('fill', '#099');

@ -10,14 +10,13 @@ path {
<body> <body>
<script src="https://d3js.org/d3.v7.min.js"></script> <script src="https://d3js.org/d3.v7.min.js"></script>
<script src="https://unpkg.com/topojson@3"></script> <script src="https://unpkg.com/topojson@3"></script>
<script src="https://cdn.rawgit.com/mahuntington/mapping-demo/master/map_data3.js" charset="utf-8"></script>
<script> <script>
var width = 960, var width = 960,
height = 500; height = 500;
var projection = d3.geoMercator() var projection = d3.geoEquirectangular()
.center([0, 5 ])
.scale(150)
.rotate([-180,0]);
var svg = d3.select("body").append("svg") var svg = d3.select("body").append("svg")
.attr("width", width) .attr("width", width)
@ -31,8 +30,19 @@ var g = svg.append("g");
// load and display the World // load and display the World
d3.json("world-110m2.json").then(function(topology) { 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);
}
g.selectAll("path") g.selectAll("path")
.data(topojson.feature(topology, topology.objects.countries).features) //.data(topojson.feature(topology, topology.objects.countries).features)
.data(new_map)
.enter().append("path") .enter().append("path")
.attr("d", path); .attr("d", path);

Loading…
Cancel
Save