Skip to content
Related Articles

Related Articles

Improve Article

D3.js geoBonne() Function

  • Last Updated : 23 Sep, 2020

The geoBonne() function in d3.js is used to draw the Bonne pseudoconical equal-area projection. The Bonne projection maintains accurate shapes of areas along the central meridian and the standard parallel, but progressively distorts away from those regions. It makes Bonne projection from given geo JSON data.



Parameters: This method does not accept any parameter.

Return Value: This method returns the Bonne pseudoconical equal-area projection.

Example: The following example makes the Bonne pseudoconical equal-area projection of the world.


<!DOCTYPE html> 
<html lang="en"
    <meta charset="UTF-8" /> 
    <meta name="viewport"
    <script src=
    <script src=
    <div style="width:700px; height:600px;"
            <h3 style="color:grey"
                Bonne Projection of World
        <svg width="700" height="550"
        var svg ="svg"),
            width = +svg.attr("width"),
            height = +svg.attr("height");
        // Bonne projection
        var gfg = d3.geoBonne()
            .scale(width / 1.5 / Math.PI)
            .translate([width / 2, height / 2])
        // Loading the json data
            + "janasayantan/datageojson/master/"
            + "geoworld%20.json", 
                // Draw the map
                    .attr("fill", "black")
                    .attr("d", d3.geoPath()
                    .style("stroke", "#ffff")


My Personal Notes arrow_drop_up
Recommended Articles
Page :