Google地图着色覆盖/多边形只适用于水 [英] Google Maps coloured overlay/polygon that only applies to water

查看:277
本文介绍了Google地图着色覆盖/多边形只适用于水的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要绘制一些易于用英语定义的沿海地区(例如,X纬度以北的海湾),但由于海岸线的原因,这些地区是非常复杂的多边形。

我是否必须绘制海岸线的整个(相关)部分,还是有办法绘制一个只能着色水的矩形(并且对土地没有影响)?

解决方案

地图绘制工具不知道地形类型。显示的图块只是Google从各种数据源生成的背景图片:在您使用API​​描述此像素为土地或此像素为水时,没有数据附加到它们。即使如此,Google Maps的绘图工具也相当愚蠢:它们只允许您在具有与经纬度匹配的坐标系的画布上绘制几何图元。



不幸的是,这意味着如果您不希望它重叠,则需要绘制几何图形以匹配海岸线。有这方面的资源,例如 NOAA海岸线数据,但它不是 - 消耗数据的一小部分工作,并在地图中提供。


I need to plot some coastal areas that are are easily defined in English (eg "water in the bay north of latitude X"), but are highly complex polygons because of the shoreline.

Do I have to plot the the entire (relevant) section of shoreline, or is there a way to draw a rectangle that only colours the water (and has no effect on land)?

解决方案

The maps drawing tools have no knowledge of the terrain type. The tiles that show up are just background images that Google has generated from various data sources: there isn't data attached to them by the time you use the API that says "this pixel is land" or "this pixel is water". Even so, the drawing tools of Google Maps are fairly "dumb": they just allow you to plot geometric primitives on a canvas which has a coordinate system that matches latitude/longitude.

Sadly, this means that your geometry needs to be drawn to match the shoreline if you don't want it to overlap. There are resources for this, such as the NOAA shoreline data, but it's a non-trivial amount of work to consume the data and serve it up in the map.

这篇关于Google地图着色覆盖/多边形只适用于水的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆