When i tried out this mod in combination with "Space Exploration", i noticed that this fog of war will only work on the starting planet/surface but not on other vertical layers (due to "local surface = game.surfaces['nauvis']")
while game.surfaces['nauvis'] == game.surfaces[1], new surfaces created within the game will be game.surfaces[2], game.surfaces[3] and so on.
Suggestions:
1) Add support for multiple layers of surfaces
2) limit the calculation (to reduce lagg in MP) to active surfaces only or whatever game list suits the best performance-wise.