## Grid Sphere

version 1.15 (10 KB) by
Produces a nearly even grid over the surface of a sphere.

Updated 13 Mar 2015

The grid may have a total of exactly 12, 42, 162, 642, ... points. Mathematically speaking, the grid may have either 12 or 2 + ( 10 * (4 ^ k) ) points, where k is a positive integer. The user may request any number of points, and the closest attainable value will be produced. All code is compatible with GNU Octave. The algorithm was developed by Nick A. Teanby of Oxford University. Refer to his website for the publication describing the approach and more elaborate geodesic grid software written in IDL: http://www.atm.ox.ac.uk/user/teanby/software.html#icos. Use the FindNearestNeighbors function, available on the MATLAB file exchange at http://www.mathworks.com/matlabcentral/fileexchange/28844-find-nearest-neighbors-on-sphere, to find the grid points closest to arbitrary query points.
GridSphere and FindNearestNeighbors share some functions in common. Each package contains a copy of these functions so that both can stand alone. To eliminate duplicates, simply move all the files into a single folder and replace the shared files when prompted.
Sample usage:
[latGridInDegrees, longGridInDegrees] = GridSphere(12)
latGridInDegrees =
-58.28253
-58.28253
-31.71747
-31.71747
0.00000
0.00000
0.00000
0.00000
31.71747
31.71747
58.28253
58.28253
longGridInDegrees =

0.00000
180.00000
-90.00000
90.00000
-148.28253
-31.71747
31.71747
148.28253
-90.00000
90.00000
0.00000
180.00000

### Cite As

Kurt von Laven (2022). Grid Sphere (https://www.mathworks.com/matlabcentral/fileexchange/28842-grid-sphere), MATLAB Central File Exchange. Retrieved .

##### MATLAB Release Compatibility
Created with R2009b
Compatible with any release
##### Platform Compatibility
Windows macOS Linux