Google地图path编码

我试图突出两条多段线之间的区域,如下所示:

在这里输入图像说明

我计算了左右多段线。 为了突出显示内部,我正在使用一个多边形,左侧的点加上右侧的多边形(正确closures多边形)。 GMSMutablePath没有反转数组的function,所以我这样做了:

for (NSUInteger i1 = 0; i1 < [reversedRight count]/2; i1 ++) { NSUInteger i2 = [reversedRight count]-i1; CLLocationCoordinate2D coord1 = [reversedRight coordinateAtIndex:i1]; CLLocationCoordinate2D coord2 = [reversedRight coordinateAtIndex:i2]; [reversedRight replaceCoordinateAtIndex:i1 withCoordinate:coord2]; [reversedRight replaceCoordinateAtIndex:i2 withCoordinate:coord1];} 

GMSMutable Arrays也没有组合。 所以我将它们转换为一个编码的string,并将它们连接起来:

  NSString *pathLeftSt = pathLeft.encodedPath; NSString *pathRighSt = reversedRight.encodedPath; NSString *spaceASCII = @"32"; NSString *combinedPaths = [NSString stringWithFormat:@"%@%@%@", pathLeftSt , spaceASCII, pathRighSt]; fullRectangle = [GMSMutablePath pathFromEncodedPath:combinedPaths]; 

我生成的path如下所示(左右path是正确的,但突出显示是closures的: 在这里输入图像说明

我很确定我的编码是closures的。 在ASCII空间的编码string之间放置“32”。 编码algorithm的说明在这里: https : //developers.google.com/maps/documentation/utilities/polylinealgorithm

我是否需要添加其他内容来正确组合这两个string,并将它们放回到GMSMutablePath?