Python: Placing objects around a spheres surface with proper rotation
You can use Euler rotations (as they usually are in the UI).

The trick is to know from what these rotations will start, considering your coordinate system (longitude, latitude).


Longitute starts along the X axis.
Latitude around Z.


Also, Blender rotations are clockwise, so you need to minus the latRad (as math convention is counter clockwise).

So, from the image in your question, as the spike is up, you need to place it along X rotating 90 around Y and remove the latRad.

x = cos( latRad ) * cos( lonRad )
y = cos( latRad ) * sin( lonRad )
z = sin( latRad )

location = Vector((x, y, z)) * radius

locationFromWorld = location + worldLocation
scale3D = (scale, scale, scale)

pin.scale = scale3D
pin.location = location

pin.rotation_euler = Euler((0,(pi / 2)-latRad,lonRad)) # &lt;&lt; Euler rotation from the given angles