I'm hoping to be able to change the "center-of-rotation" (CoR) about a 3D globe which is given by the code below. Currently the CoR is about the center of the sphere itself, however, I'd love to be able to, for example, change the CoR to be about New York city, or any surface location for that matter. That is, I'd like to be able to move the CoR, which is by default set to (x,y,z)=(0,0,0), to a point on the surface of the sphere, a radial distance R from the sphere's center. Is such an option possible?

EarthTexture = 
EarthSphere = 
  ParametricPlot3D[{Cos[u] Sin[v], Sin[u] Sin[v], Cos[v]}, {u, 0, 
    2 Pi}, {v, 0, Pi}, Mesh -> None, PlotPoints -> 100, 
   TextureCoordinateFunction -> ({#4, 1 - #5} &), Boxed -> False, 
   PlotStyle -> Texture[Show[EarthTexture]], Lighting -> "Neutral", 
   Axes -> False, RotationAction -> "Clip", 
   ViewPoint -> {-2.026774, 2.07922, 1.73753418}, ImageSize -> 800];
Show[EarthSphere, PlotRange -> Automatic]
  • 2
    $\begingroup$ Have you seen ViewCenter? $\endgroup$
    – Michael E2
    Aug 6, 2016 at 2:07
  • $\begingroup$ ViewCenter looks to work nicely, but I'm struggling to figure out how to change the center-of-rotation to a specific point on Earth. Would it be possible, given latitude, longitude and the radius of Earth, to accurately set ViewCenter? $\endgroup$ Aug 6, 2016 at 20:14

1 Answer 1


The documentation says that

The setting for ViewCenter is given in scaled coordinates, which run from 0 to 1 across each dimension of the bounding box.

so it should just be case of converting from lat/long to graphics coordinates and then to scaled coordinates.


earth = ParametricPlot3D[{Cos[u] Sin[v], Sin[u] Sin[v], Cos[v]}, {u, 0, 2 Pi}, {v, 0, Pi},
   Mesh -> None, PlotPoints -> 30, Boxed -> False, Axes -> False, 
   TextureCoordinateFunction -> ({#4, 1 - #5} &),
   PlotStyle -> Texture[EarthTexture],
   Lighting -> "Neutral"];

pt[city_] := Module[{v, u},
  {v, u} = LatitudeLongitude@GeoPosition@city;
  {-Cos[u] Cos[v], -Sin[u] Cos[v], Sin[v]}]

Entity["City", {"London", "GreaterLondon", "UnitedKingdom"}], 
Entity["City", {"NewYork", "NewYork", "UnitedStates"}], 
Entity["City", {"Tokyo", "Tokyo", "Japan"}]};

 Show[earth, Graphics3D[{Red, Arrow@Tube[{1.3 pt[c], pt[c]}]}],
  ViewCenter -> Dynamic[0.5 + 0.5 pt[c]]], {c, cities}]

enter image description here

  • $\begingroup$ Hi Simon, thanks very much for the reply, but I seem to be getting errors when I run your code regarding lists not being of the same shape. The errors are of the form "Lists {v$1518, u$1518} and {51.5, -0.116667} Degree are not the same shape." $\endgroup$ Aug 7, 2016 at 10:24
  • $\begingroup$ @AlexR that's odd, what do you get from FullForm[LatitudeLongitude@GeoPosition@cities[[1]]] ? $\endgroup$ Aug 7, 2016 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.