问题描述
我产生了随机的经度和纬度。但无法找到随机经纬度的土地或水。检查与谷歌API,我没有找到,我在谷歌搜索。但我找不到解决方案,请帮助我。我使用此来源()网址。它仅提供每分钟15个请求。我需要50 lat和long来检查它是否是土地或水。今天,最简单的方法是使用Google 和:您可以为您的Lat创建只有一个像素地图(大小= 1x1)的请求除了 water 并将 water 颜色设置为纯蓝色(0x0000FF)。类似的东西
{YOUR_LAT},{YOUR_LON}&安培;变焦= {YOUR_ZOOM}&安培;大小= 1×1&安培;式=特征:所有|可见度:off& style = feature:water | visibility:on& style = feature:water | color:0x0000FF& key = {YOUR_API_KEY}
然后下载它在的答案中Vivek Khandelwal ):并测试一个像素的颜色,如:
if它是蓝色(0x0000FF) - 纬度/经度坐标上有水。
注意!您应该设置适当的缩放级别,并记住整个地球的所有缩放级别都不包含地图图块。在地图上也可能会漏掉一些水/地球。所以,这不是100%正确的解决方案,但希望它有帮助。
I am generating random latitude and longitude. But unable to find land or water for random lat and longitude. Checked with google API, I am not finding and I searched in google. But I cannot find solution, please help me. I used this source (https://onwater.io/users/sign_up )url. It gives only 15 request per minute. I need 50 lat and long to check whether it is land or water.
For today easiest way to do this is to use Google Static Map API and Styled Maps: you can create request for just one pixel map (size=1x1) for your Lat/Lon coords with hidden all features except water and set water color to e.g. pure blue (0x0000FF). Something like that
https://maps.googleapis.com/maps/api/staticmap?¢er={YOUR_LAT},{YOUR_LON}&zoom={YOUR_ZOOM}&size=1x1&style=feature:all|visibility:off&style=feature:water|visibility:on&style=feature:water|color:0x0000FF&key={YOUR_API_KEY}
Then download it (like in this answer of Vivek Khandelwal):
and test color of one pixel like in that answer of Raz:
if it blue (0x0000FF) - there is water on your Lat/Lon coords.
NB! You should set appropriate zoom level and remember that is no map tiles for all zoom levels for entire Earth. Also some water/earth can be missed on map. So, that is not 100% right solution, but hope it helps.
这篇关于谷歌地图检查土地或水的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!