One of the prerequisites for the Prayer is facing the direction of qiblah. However, if one happens to be in a place where one cannot define the direction of qiblah, one is to try every possible means to know its direction. Yet, if it came out later that one prayed in the wrong direction, then one does not need to repeat the Prayer.
Sheikh Ahmad Kutty, a senior lecturer and Islamic scholar at the Islamic Institute of Toronto, Ontario, Canada, states: If we are unable to find the direction of qibla, all that we are required to do is simply to make an educated guess based on whatever evidence we can think of, and pray. If after having prayed, we found out that we prayed in the wrong direction, we don’t need to repeat the Prayer.
Therefore, we need not worry about the validity of your Prayer since you tried to make an educated guess in the given circumstance.