View Full Version : Plotting locations on Matlab 3D sphere

11-01-2013, 08:24 PM
Well, I've a 250x3 matrix containing some geographic coordinates locations, where the first column represents the latitude (-90 to 90), the second one longitude (-180 to 180), and the third one is just the radius (for now, I'm not considering altitude, so it's the same value for all).

I've tried creating a sphere, but I can't see how to plot the points on it. I've also just tried by plotting using sph2cart (for using this I made all latitudes and longitudes positive and running between 0 and 360) and then plot3. This option gives me a "sphere of points" with the correct radius, but wrong locations. Is possible to do this on Matlab?

The code looks like this:

superdat; % This is the 250x3 matrix of coordinates
[datacbo datacba datacz]=sph2cart(superdat(:,1)*(pi/180),superdat(:,2)*(pi/180),superdat(:,3));

Extra: a plot of the coordinates in 2D-Equirectangular projection


11-01-2013, 08:38 PM
Elevation is measured relative to one of the poles, not to the equator. You probably need to add a quarter turn to all your latitudes to get elevations.

10-26-2014, 11:47 PM
an old post but this is easy to do in Blender
a normal everyday CSV file nasa/jpl uses these a LOT
take for example Jupiters moon Amalthea (j5amalthea.tab)
from :
h t t p : / / sbn.psi.edu/pds/asteroid/EAR_A_5_DDR_STOOKE_SHAPE_MODELS_V1_0/data

has 2700 lines in this format -- first 10 lines

0 -90 53.000000
0 -85 56.033870
0 -80 60.277550
0 -75 63.620630
0 -70 67.513030
0 -65 71.267010
0 -60 74.758350
0 -55 76.839240
0 -50 81.041340
0 -45 83.871950

Longitude , latitude , and Radii in Kilometers
now you can just convert this to a flat plain very easy
it is a 3 band CSV ascii raw file 72 x 37 pixels ( 37 for the odd single pix at the north and south pols )
i use ISIS3 but any program that handles csv files will do
-- Even EXCEL or OO's Calc or lotus 123
a screenshot in Nip2
http://4.t.imgbox.com/FVZXrTZU.jpg (http://imgbox.com/FVZXrTZU)
there is a blender plugin for importing the nasa /jpl PDS dem's
-- see the blenderartists forum and the blended plugin pages
Extensions:2.6/Py/Scripts/Import-Export/NASA IMG Importer - BlenderWiki (http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Import-Export/NASA_IMG_Importer)
it opens like this in Blender
http://t.imgbox.com/oau323pz.jpg (http://imgbox.com/oau323pz) http://t.imgbox.com/90wLnThZ.jpg (http://imgbox.com/90wLnThZ)