D3 Geo map rotate problem

D3 Geo map rotate problem
0

#1

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

http://codepen.io/m1s/pen/bBMxYK?editors=0110

#2

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.

#3

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 .
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 and more i spend time with d3 my respect goes higher and higher for mike bostock

#4

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

#5

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

#6

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, θ, φ).

#7

after couple of modification its work as I expected
http://codepen.io/m1s/pen/XNBBRg?editors=0010

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

#8

I’m such a maths durp

#9

can you take look is it laggy in you end
mouse wheel for zoom and mouse move for rotation
http://codepen.io/m1s/pen/XNBBRg?editors=0010

#10

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.

#11

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

http://codepen.io/m1s/pen/XNBBqz?editors=0110

#12

oh wow yeh, thats much better

#13

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