Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9008795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:01:42+00:00 2026-06-16T02:01:42+00:00

I have successfully loaded geoJSON files loaded the feature collection into a d3.geo.path() The

  • 0

I have successfully loaded geoJSON files loaded the feature collection into a

d3.geo.path() 

The problem with my current implementation is that it starts off the scaling such that the path is a point, and I have to zoom in each time. Now I know there are plenty of methods to about setting the zoom level right, but I was hoping to use

d3.geo.bounds()

Given the following geoJSON feature:

json.features[0]:

Object
geometry: Object
coordinates: Array[2]
0: -71.248913
1: 44.078426
length: 2
__proto__: Array[0]
type: "Point"
__proto__: Object
id: 2
type: "Feature"
__proto__: Object

and

json.features[1]:

Object
geometry: Object
coordinates: Array[2]
0: -71.249021
1: 44.078387
length: 2
__proto__: Array[0]
type: "Point"
__proto__: Object
id: 3
type: "Feature"
__proto__: Object

If I execute

d3.geo.bounds(json.features)

I get infinity for the bounds:

d3.geo.bounds(json.features)
[
Array[2]
0: Infinity
1: Infinity
length: 2
__proto__: Array[0]
, 
Array[2]
0: -Infinity
1: -Infinity
length: 2
__proto__: Array[0]
]

I’m unsure what is wrong, clearly I have a much larget dataset than above, but I’m just trying to understand the output. This output does not make sense to me and clearly missing something simple about d3 handling of geoJSON data. Any help to get the bounds to work would be helpful.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T02:01:43+00:00Added an answer on June 16, 2026 at 2:01 am

    d3.geo.bounds takes a single Feature or a FeatureCollection as argument, not an array of features. See the documentation. You need to call e.g.

    d3.geo.bounds(json.features[0])
    

    If you want a bounding box that contains all features, you need to get the bounding box for each one in turn and then calculate the union of those.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have successfully created a feature in sharepoint that modifies the existing edit dialog
I am new to R language. I have successfully loaded a query's resultset into
Suppose I have 5 GLSL shaders that I successfully loaded in my opengl program.
I have successfully loaded a single texture using the gltLoadTGA function that I have.
I have a .plist file that is loaded into my Xcode project. I have
I have successfully loaded the sqlsrv_pdo_54 driver that is right for me with ts
I have a form I've successfully loaded into a lightbox. The lightbox appears without
I have successfully loaded the muscleName items into a table view but am not
I have created thumbnail view using Three20 bundle. I have successfully loaded and displayed
i use github and have successfully added and synched files on my laptop in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.