When I sent a osm map request for a tile (a small geo region in square), I got empty osm xml file if the small geo region is inside of ocean, but How I know it is ocean or land when I want to draw map for the small geo region?
Any information is appreciated. Thank you very much.
If there is no similar topic asked at http://help.openstreetmap.org yet, I would try to enter into OSM data structure about the special cases of coastlines. Maybe with any geospatial queries you can determine whether a certain position is land or water.
I’d say for using subsets of the database we’re assuming the user (human or not) to know where he is. The other option would be to add is_in=* to every object, which still wouldn’t solve the problem of an empty dataset.
Download the land polygons shapefile and check with them if your area is land or sea http://openstreetmapdata.com/data/land-polygons. It may still fail if you hit in the middle of a big lake.
Query the pixel values from the OSM slippy map service by your coordinates. If RGB value is of a water colour, it is water.
That’s the solution I intend to use for my own rendering software which also has that problem (didn’t get around to coding it yet). In a tiled system, it’s sufficient only store one water/not(-entirely)-water bit for the entire tile.
Lakes are also a problem, but separate one, I believe - due to the special treatment of coastlines in OSM it has more in common with being in the middle of a forest than with being in the middle of an ocean.
I am interested in the solution of “- Query the pixel values from the OSM slippy map service by your coordinates. If RGB value is of a water colour, it is water.”
Could you please give me more information about this, is there is any programing API to query OSM Slippy map? I know the current location I am query, do I need send http request to some server?