Saturday, October 25, 2025
HomeLanguagesJavascriptD3.js geoBertin1953() Function

D3.js geoBertin1953() Function

The geoBertin1953() function in d3.js is used to draw the Jacques Bertin’s 1953 projection. It makes the Baker Bertin’s 1953 projection from given geo JSON data.

Syntax: 

d3.geoBertin1953()

Parameters: This method does not accept any parameters.

Return value: This method returns the Bertin1953 projection.

Example: The following example makes the Bertin’s 1953 projection of Africa.

HTML




<!DOCTYPE html> 
<html lang="en"
  
<head
    <meta charset="UTF-8" /> 
    <meta name="viewport"
        content="width=device-width, 
                initial-scale=1.0"/>
    <script src=
        "https://d3js.org/d3.v4.js">
    </script>
    <script src=
    </script>
</head>
  
<body
    <div style="width:400px; height:300px;"
        <svg width="600" height="300"
        </svg
    </div
      
    <script>
        var svg = d3.select("svg"),
            width = +svg.attr("width"),
            height = +svg.attr("height");
  
        // Bertin1953 projection
        var gfg = d3.geoBertin1953()
            .scale(width / 1.5 / Math.PI)
            .translate([width / 2, height / 2])
  
        // Loading the json data 
        d3.json("https://raw.githubusercontent.com/"
            + "janasayantan/datageojson/master/"
            + "geoAfrica.json", 
            function(data){
                // Draw the map
                svg.append("g")
                    .selectAll("path")
                    .data(data.features)
                    .enter().append("path")
                    .attr("fill", "black")
                    .attr("d", d3.geoPath()
                        .projection(gfg)
                    )
                    .style("stroke", "#ffff")
        })
    </script>
</body
  
</html>


Output:

Bertin 1953 Projection

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

Most Popular

Dominic
32361 POSTS0 COMMENTS
Milvus
88 POSTS0 COMMENTS
Nango Kala
6728 POSTS0 COMMENTS
Nicole Veronica
11892 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11954 POSTS0 COMMENTS
Shaida Kate Naidoo
6852 POSTS0 COMMENTS
Ted Musemwa
7113 POSTS0 COMMENTS
Thapelo Manthata
6805 POSTS0 COMMENTS
Umr Jansen
6801 POSTS0 COMMENTS