I have an algorithm that generates "continents" using simplex noise, so it'll generate a height map, and when a pixel/tile is above a certain level it'll be recognised as land, otherwise it's water.
The problem I have is sometimes land will surround a section that is below sea level. I would like to be able to identify those areas because they won't be sea, but rather land or a lake.
So the in following the 0's represent water and 1's represent land:
000000000
001110100
011111110
011001110
001101100
001111000
000000000
The 3 0's in the middle would be identified as non-sea.
I am familiar with the flood fill algorithm. So one way I could do it is to iterate through random points, use a flood fill if I find water, if it's over a certain size then it'll be the sea. Then once the sea has been recognised I can go through and identify non-sea bodies for water.
This seems inefficient as I will have to work with a larger area than what is loaded otherwise it'll falsely recognise areas as non-sea.
Is there a better way?