本文介绍了我可以强制Google地图将重叠路径的多边形绘制为联合而不是交叉点吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个自定义的Google地图,我需要有由多个多边形组成的地点标记。当我使用KML文件时,多边形会合并在一起,但由于需要以页面上其他项目的编程方式呈现infowindow,因此必须放弃KML。



现在我直接绘制多边形(新的google.maps.Polygon)我发现有时这些项目通过交叉点通过联合和某些东西相连接。这似乎与多少重叠有关。



我的多边形正在构建具有相应标签的形状,所以我希望尽可能将两者保持为单独的路径(虽然这不是必需的)。



有可能我错过了一个设置,告诉引擎如何加入路径? 不会显示任何内容,但也许有隐藏的功能可以执行此操作。

解决方案

如果在多边形中有多个路径,那么如果卷绕方向相反(区域的相对顺序即顺时针或逆时针)。

一些例子:




  • li>




I'm working on a custom Google Map where I need to have place marks made up of several polygons. When I was using a KML file, the polygons would union together, however I had to abandon KML due to the need to present the infowindow programmatically from other items on the page.

Now that I'm drawing polygons directly (new google.maps.Polygon) I find that sometimes the items are joined via union and somethings via intersect. This appears to be related to how much overlap there is.

My polygons are building shapes with their corresponding labels so I've wanted to keep the two as separate paths if possible (though this isn't necessary).

Is it possible I'm missing a setting that tells the engine how to join the paths? PolygonOptions shows nothing, but perhaps there's a hidden feature to do this.

解决方案

If you have multiple paths in a polygon, the regions will subtract if the winding direction is opposite (the relative order of coordinates i.e clockwise or counter-clockwise).

Some examples:

similar question

这篇关于我可以强制Google地图将重叠路径的多边形绘制为联合而不是交叉点吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 15:08