Well, I am not sure how much these short answers may help “beginners” but at least as kind of guidelines should show the complexity of the issue. Note also that OSM is not a map but data used for creating maps (after complex preparation processing).
1. If you have a raster map you should detect the water colour code(s) from the stiles/decorations specification. Then, you should place your point(s) into the corresponding pixel(s) in the map and check the pixels colour code. If this is equal to the waters’ code, your point is in a water body. Of course, you may have many versions of this raster approach. As a rule, on large areas you need scales 1:4-5,000,000 or lower and the results are less accurate.
2. In a vector version you should have a vector-area data layers for the planet_sea (or planet_land), rivers, lakes, channels… (or a layer for union of these). Besides, you should have a function point-in-polygon (that returns info whether a point is inside, on the border or outside a polygon). There are many versions of this function with varying efficiency (you may find versions even in student books). The best ones are those close to hardware and consist of just a several lines of code. How to use this function is rather strait forward. Again, a tiled version of the water area data layers may radically increase the efficiency of you search. This, because you may apply a simple early filtering.
Here is an example, a case, similar to your issue for illustration. The river-line data contains roughly 250,000,000 (250 million) nodes. The river area objects around 53,000,000. Assume, you don’t want the river-line sections that are covered with the river areas (huge number of redundant points). If we run the search function for the nods on the large (none tiled) river objects it takes many, many hours on a powerful laptop. The same procedure on a tiled river objects takes only several (3-4) minutes.
answered
21 Sep '14, 10:32
sanser
695●38●39●55
accept rate:
5%
Do you need this for the whole planet ? Do you have some skills on postGIS database and queries ?