D3 Geo map rotate problem

currently, i am doing Map Data Across the Globe
but I want it to do it little differently I want the map to look like the globe
So, i am using d3.geoOrthographic
now I can zoom or drag the map
but I can’t manage to rotate the map anyhow
can anyone give me any idea how to update the projection or rotation

btw I am using V4. I guess in v3 it would be much simpler :frowning:


It seems like anytime I want to do some in D3 that I assume is either hard or impossible, Mike Bostock has a working example of it and the code is straightforward. Here is his working example of just what you want, and it should be really easy to adapt.

I am constantly in awe of D3’s API. It should be the gold standard for how we write libraries.

thanks for the link :slight_smile:
i need to learn how google .i mean i search with every single word that came to my mind but didn’t come across this :frowning: .
thought the example you share in version 3 but hope it will help me to achieve similar output in v4

and about D3 i don’t like to call it libraries rather call it a Swiss Army Knife :stuck_out_tongue: and more i spend time with d3 my respect goes higher and higher for mike bostock

Off topic i suppose, but what the hell is φ in the code in your link?

I think it is just a one of the variable in Euler_angles
represents a rotation around the z axis

1 Like

Phi is, in the context of spherical rotations, the angle between the positive Z-axis and the point, Q, that you’re rotating to from the original point, P. So, when you move the mouse “up”, it changes that angle, which rotates the globe “vertically”.

We’re used to thinking about 3D coordinates as (x, y, z). For polar coordinates, it’s (p, θ, φ).

1 Like

btw you link was great
after couple of modification its work as I expected :smiley:

one thing though if use both rotation and zoom the transaction becomes super laggy :confused:

I’m such a maths durp

can you take look is it laggy in you end
mouse wheel for zoom and mouse move for rotation

Not so much laggy as it feels like the rotation steps are wide apart, if you know what I mean. Like its jumping in 10degree increments or something.

I’ve never used this stuff btw so forgive my terminology.

EDIT - it depends how quick i move my mouse. If i move it very slowly its very smooth.

no need to ask for forgiveness you are so helpful :slight_smile:

can you check this like too ? and compare to the previous one ?


oh wow yeh, thats much better :thumbsup:

i just stop the zoom option :confused: maybe i need to avoid that feature