使用嵌套多边形数组中的实际面积查找最里面的多边形
Find Inner most Polygon using actual Area from array of nested Polygon
我有 GMSPath
的数组和坐标。我想找出这个坐标落在的路径。我能够找出该位置所在的总多边形。 (使用这个 )到这一步为止一切正常。
当一个关闭的 GMSPath
与另一个关闭的 GMSPath
重叠并且坐标位于重叠区域时,就会出现实际问题。按照我的要求,我只需要从这两个中得到一个GMSPath
,并且面积比另一个小
请参考图片以便更好地理解。
您可以使用 Google Maps iOS SDK GMSGeometryArea()
中的以下方法找出 GMSPolygon
的面积,它提供给定多边形的面积。现在你有了面积,所以你可以比较不同的多边形并找到最里面的面积。
double GMSGeometryArea(GMSPath *path);
根据 google
提供的描述
Returns the area of a geodesic polygon defined by |path| on Earth.
The "inside" of the polygon is defined as not containing the South pole.
If |path| is not closed, it is implicitly treated as a closed path nevertheless and the result is the same.
All coordinates of the path must be valid.
If any segment of the path is a pair of antipodal points, the result is undefined -- because two antipodal points do not form a unique great circle segment on the sphere.
The polygon must be simple (not self-overlapping) and may be concave.
我有 GMSPath
的数组和坐标。我想找出这个坐标落在的路径。我能够找出该位置所在的总多边形。 (使用这个
当一个关闭的 GMSPath
与另一个关闭的 GMSPath
重叠并且坐标位于重叠区域时,就会出现实际问题。按照我的要求,我只需要从这两个中得到一个GMSPath
,并且面积比另一个小
请参考图片以便更好地理解。
您可以使用 Google Maps iOS SDK GMSGeometryArea()
中的以下方法找出 GMSPolygon
的面积,它提供给定多边形的面积。现在你有了面积,所以你可以比较不同的多边形并找到最里面的面积。
double GMSGeometryArea(GMSPath *path);
根据 google
提供的描述Returns the area of a geodesic polygon defined by |path| on Earth.
The "inside" of the polygon is defined as not containing the South pole.
If |path| is not closed, it is implicitly treated as a closed path nevertheless and the result is the same.
All coordinates of the path must be valid.
If any segment of the path is a pair of antipodal points, the result is undefined -- because two antipodal points do not form a unique great circle segment on the sphere.
The polygon must be simple (not self-overlapping) and may be concave.