Space, the Final Frontier
The great thing about outer space is that it can be whatever you need it to be. We don't hear much about political boundaries here, or the location of Regula One in relation to Earth. We don't need to: we're in outer-freaking-space.
The screenwriters cheerfully lay down everything they need: a desert planet of marooned pirates, a nebula where the shields don't work…whatever the narrative demands, they can conjure it out of whole cloth. Because space is just that big.
But here's the thing: you could say the same thing about the ocean in 18th- and 19th century adventure stories. The world hadn't been mapped out back then. There were still plenty of corners where anything could crop up. People believed in little mermaids and giant sea dragons.
And director Nicholas Meyer drew upon these swashbuckling tales of the high seas as inspiration for Star Trek II. The planets here could easily be islands (or even hidden countries) in a some ocean-bound tale. Both settings have the same plastic quality, letting the storytellers turn them into whatever they want without much of a fuss.
After all, before people even dreamed of going off into space, the oceans were the final frontier.