Wednesday, June 10, 2026
HomeLanguagesJavascriptD3.js geoBoggs() Function

D3.js geoBoggs() Function

The geoBoggs() function in d3.js is used to draw the Boggs eumorphic projection. The Boggs eumorphic projection is a pseudo cylindrical, equal-area map projection used for world maps. It makes Boggs eumorphic projection from given geo JSON data.

Syntax: 

d3.geoBoggs()

Parameters: This method does not accept any parameters.

Return Value: This method returns the Boggs projection.

Example: The following example makes the Boggs projection of Asia.

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:700px; height:500px;">
        <center>
            <h4 style="color:green">
                Boggs Projection of Asia
            </h4>
        </center>
  
        <svg width="500" height="200">
        </svg>
    </div>
  
    <script>
        var svg = d3.select("svg"),
            width = +svg.attr("width"),
            height = +svg.attr("height");
  
        // Boggs projection
        var gfg = d3.geoBoggs()
            .scale(width / 1.5 / Math.PI)
            .translate([width / 2, height / 2])
  
        // Loading the json data 
        d3.json(
            "https://raw.githubusercontent.com/"
            + "janasayantan/datageojson/master/"
            + "geoasia.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:

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

6 COMMENTS

Most Popular

Dominic
32515 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6896 POSTS0 COMMENTS
Nicole Veronica
12012 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12109 POSTS0 COMMENTS
Shaida Kate Naidoo
7019 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6976 POSTS0 COMMENTS
Umr Jansen
6963 POSTS0 COMMENTS