Let me start by saying that I am not a GIS expert nor a cartographer , and my knowledge of GIS is limited to the quasi-null professional training I had as an architect.

My question here was triggered by another question I have asked on stackoverflow regarding the use of Google maps API.

My problem is this : I am making a web-app or a website, where I need to generate quasi random points on the surface of the earth.

Those points however , should be , like pointed on the SURFACE of the earth as intended in SOLID surface . (e.g. not in the middle of the ocean or deep inside a lake) In shorts - I need to be able to "separate" the bodies of water from the solid surface .

I am a fairly okay programmer for web-technologies, especially PHP - so generating points (nodes) was a 1-minute job , but verifying that they are "accessible" points to humans without a floating vehicle was another issue.

I will be able to exclude coordinates from the generated array - but where can I get this info ?

Is such information (like worldwide bodies-of-water including seas oceans lakes) available as coordinates ? as boundaries ?

Does anyone here knows how to use the data from Google-maps for this purpose ? like I said in the original question - they obviously have this data (the bodies of water are blue) - but can users separate those layers ?

I have from previous works a fairly okay resolution (for my purpose) of vector world map - But I have no Idea how to use it to generate even approximation coordinates ..

Please remember that I am not a GIS expert , so If you use any technical terms , Please try to explain them like you would explain to your 2-years-old neighbor´s kid .

Any help as to how to approach this will be more than appreciated.


The GIS operation within or overlap would perhaps be useful.

This is one option available.

  1. Get Saga GIS ( http://www.saga-gis.org/en/index.html ).
  2. Import your point data Modules->Files->Shapes->Import->Shapes from XYZ.
  3. Get your polygon boundary data, countries and water boundaries perhaps ( http://thematicmapping.org/downloads/world_borders.php ).
  4. Import the SHP files File->Shapes->Load.
  5. Clip Points with Polygons Modules->Shapes->Points->Clip Points with Polygons.

yours points file should be in XYZ csv format i believe. There is another way that you can load an entire table then convert the table to a points feature within SAGA that way you retain your attribute data.

This should create another dataset that contains only those points that fall within your country dataset.

To further remove those that would be within rivers / lakes you would require a more detailed land mass dataset.

-Edit XYZ file formating first row column headings seperated by tab characters sub rows xyz seperated by tab characters. It seems to read to 6 decimal places hope that can't seem to find any specific documentation on it though.

1.000001 [TAB] -1.000001 [TAB] 1.000001 [NEWLINE]
  • thanks , but when you say points (xyz) - does that mean i can use the (xy) for Lat,Lon ? and if so , what is the resolution of the floats ? – Obmerk Kronen Mar 12 '12 at 0:19
  • modified my answer can't find any documentation on the module but seems to be to 6 decimals and yes you can interchange XY for Lat lon just leave Z as 0 or don't even populate it. – Jamo Mar 12 '12 at 0:47
  • Some other alternative datasets for ocean/land: naturalearthdata.com/downloads/10m-physical-vectors – julien Apr 11 '12 at 18:56

I am not sure how to extract this information from GoogleMaps about water bodies.

Check this link though: http://www.epa.gov/waters/data/downloads.html

Once you have this information, i.e. shapefiles with landclasses, then you can check for your point being in a polygon (say a polygon with class 'water'). A python code to check for this is like 25-30 lines. Several algos exist, which you can check or I can provide this detail too if you want. You can optimize the algorithm for larger dataset and for real time check.

Cheers N

  • Thanks a lot for the link - but actually I have already seen that website - unfortunately as I understand it - it is only the US. It is very hard for me to believe that there is no cartography resource that can supply such a simple information as large bodies of water on the planet .. – Obmerk Kronen Mar 13 '12 at 4:58
  • As far i remember, friend of mine did a project on Mekong river basin, and the data she used was from USGS. They have a full network of watershed. I will check for the link with her. But may be you can try yourself on USGS (US Geological Survey) website. Though the data might not be as high res as you might need. For example small lakes in counties like Netherlands might cause trouble in terms of accessibility. I am curious myself if you can find some data like this. Will post further once I find something. – Naresh Mar 13 '12 at 11:04

You could try to extract something from a web mapping service (preferably OpenStreetMap). There are pre-existing polygons for water available here.

Alternately, you could try connecting a raster land-cover dataset. There is the GLCF 250m MODIS water mask, free with acknowledgement, and the GLOBCover 300m dataset free for noncommercial purposes.

EDIT: And a NASA-produced MODIS water mask that should be in the public domain.

PS, a hidden pitfall: Ensure that your quasi-random points are projection-based rather than based on random latitude and longitude. The areas near the poles beyond 80 degrees in latitude constitute about 1.5% of the Earth's surface, but a random latitude-longitude pairing will place 11.1% of the points in those areas.


You may test the google elevation API: A request for a location on the sea will return a negative elevation value, while another on the plain old ground will return a positive elevation value.

If the number of points you need to test remains small enough, you should not exceed the quota. The use of paths may help solving this limitation.

  • Thanks for the answer but as was already discussed in other comments , this method will not work for land- locked bodies of water (like lakes) nor will it return correct results for under-sea level dry land. basically it will only work for the oceans . (and other connected seas like mediterrenian or red sea) – Obmerk Kronen Apr 13 '12 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.