Expanding on John Ballinger, i have successfully used this trick:
- Get a 1x1 pixel google image static map centered on your coordinates
- Style map to black (land) and white (water) via Google Maps API styling
- Find whether the pixel is black or white
In php:
$lat = your latitude
$lon = your longitude
$im = imagecreatefrompng('http://maps.googleapis.com/maps/api/staticmap?center='.$lat.','.$lon.'&zoom=21&format=png&sensor=false&size=1x1&maptype=roadmap&style=feature:administrative|visibility:off&style=feature:landscape|color:0x000000&style=feature:water|color:0xffffff&style=feature:road|visibility:off&style=feature:transit|visibility:off&style=feature:poi|visibility:off');
//get pixel color, put it in an array
$color_index = imagecolorat($im, 0, 0);
$color_tran = imagecolorsforindex($im, $color_index);
//if, for example, red value of the pixel is 0 we are on land
if($color_tran['red']==0){
//do your thing
echo "we are on land";
}