Here's a node setup, which sets the colour based on the distance from a specified point in the XY plane.

The inputs to the node group1 are as follows:
X Origin - The X coordinate of the point from which to calculate the distance
Y Origin - The Y coordinate of the point from which to calculate the distance
Inner perimeter - The threshold at which distance is set to 0 (i.e. closer than this will be all red).
Outer perimeter - The distance at which distance is set to 1 (i.e. farther than this will be all blue)
Here's the inside of the node group:

The Location output of the Object info node, gives the Object's location in World coordinates.
The Separate XYZ separates a vector or position in three values, one for each of X, Y and Z components of the vector/position.
The following math nodes up to and including the last Power node calculate the distance from the specified point according to the common distance formula.
The Subtract node following the Power node subtracts the Inner perimeter from the calculated distance.
The Subtract node below that calculates the distance between the Inner and Outer perimeters.
Finally, the Divide node divides the distance between the object and the centre point by the distance between the Inner and Outer perimeters.
The output is a value which at the Inner perimeter will be 0 (closer than that, will yield a negative value) and at the Outer perimeter will be 1 (farther away will yield a value that is greater than 1). The Fac input of the ColorRamp clamps the values that are outside 0-1, so the fact that we get values greater than 1 and less than 0 won't be a problem.
Here's an animated GIF of the result:
And here's the blend (it's basically the same blend you provided, with the material for the "planet" modified).
1When using node groups, you can edit the contents of a node group by selecting it and pressing Tab to get inside the group. When inside a node group, you can get back to the overview by pressing Tab again.