How to import Long and Lat (GPS Info) from a flat file and render the points.

Hi All,

I have a sphere withe a texture of the earth wrapped around it. Currently I can zoom and and out on the sphere and I can rotate the sphere all with the key board. Now I have an XML (I could easily make it a JSON) file that contains longitude and latitude points, I would like to render these points on the sphere.I can’t seem to find a way to do that.

Thank You!
Barchuleta

Parsing XML data and converting strings to floats is been covered a number of times on Unity Answers. A quick Google search leads me to these two functions for converting these floats to a position:

function LatLongToDecimal(degrees : float, minutes : float, seconds : float) : float {
 	return degrees + minutes/60.0 + seconds/3600;
 }
 
 function LatLongToLocal(decimalLat : float, decimalLong : float) : Vector3 {
 	return Quaternion.AngleAxis(decimalLong, Vector3.up) * Quaternion.AngleAxis(decimalLat, Vector3.forward) * Vector3.right * 0.5;
 }

The local coordinate returned by LatLongToLocal can be converted to a world coordinate using Transform.TransformPoint().