Карта, созданная с использованием geo json и D3, не отображается в chrome - PullRequest
0 голосов
/ 26 мая 2020

Я скопировал этот html и дал свой адрес гео json файла (https://raw.githubusercontent.com/shklnrj/IndiaStateTopojsonFiles/master/Punjab.geojson), но на веб-странице ничего не отображается.

<!DOCTYPE html>

<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Punjabi</title>
   <script src="http://d3js.org/d3.v5.min.js"></script> 
    <style type="text/css">     
    </style>
</head>
<body>
    <script type="text/javascript">
        //Width and height
        var w = 500;
        var h = 300;
        //Define map projection
        var projection = d3.geo.albersUsa()
                               .translate([w/2, h/2])
                               .scale([500]);
        //Define path generator
        var path = d3.geo.path()
                         .projection(projection);
        //Create SVG element
        var svg = d3.select("body")
                    .append("svg")
                    .attr("width", w)
                    .attr("height", h);
        //Load in GeoJSON data
        d3.json("https://raw.githubusercontent.com/shklnrj/IndiaStateTopojsonFiles/master/Punjab.geojson", function(geojson) {

            //Bind data and create one path per GeoJSON feature
            svg.selectAll("path")
               .data(geojson.features)
               .enter()
               .append("path")
               .attr("d", path)
               .style("fill", "steelblue");

        });

    </script>
</body>

Что-то не так с кодом chrome или моим html?

...