block by pbogden d02a16d867c3d8a3dbf26f4a9bb9e6b1

Rotating GeoJSON in Three.js

Full Screen

GeoJSON in Three.js rotating about the North Pole.

In Mike Bostock’s original, the “z” axis is parallel to the North Pole. In Three.js, the default is “y” axis pointing “up”. Transform from original Cartesian axes to Three default by rotating 270 degrees about the X axis.

xThree = x = cos(φ)cos(λ)   φ = latitude
zThree = - y = - cos(φ)sin(λ)   λ = longitude
yThree = z = sin(φ)

That is:

index.html