在 GMSPolygon 中添加图像

Add image in GMSPolygon

有什么方法可以将图像添加到 GMSPolygon 中吗?

我可以使用 GMSGroundOverlay 添加图像,但它不是我需要的完美矩形。

请检查附图,在这张图片中,有一个黑色轮廓的框是一个多边形,我需要在那个框中添加 building/floor 图片。

您还可以在白色背景的附图中看到 GMSGroundOverlay。 GMSGroundOverlay 基本上是一个包含所有添加点的大矩形。

谢谢,

这可以使用 Mapbox SDK 完成。

https://www.mapbox.com/ios-sdk/examples/image-source/

GMSMarker *ann = [[GMSMarker alloc]init];

    double latitude = [[dictMeter valueForKey:@"latitude"] doubleValue];
    double longitude = [[dictMeter valueForKey:@"longitude"] doubleValue];

    CLLocationCoordinate2D coordinate = CLLocationCoordinate2DMake(latitude, longitude);

    ann.position = coordinate;


ann.appearAnimation = kGMSMarkerAnimationPop;

    UIImageView *markerImage = [[UIImageView alloc]init];
    markerImage.frame = CGRectMake(0.0, 0.0, 35.0, 60.0);
    markerImage.contentMode = UIViewContentModeScaleAspectFit;

    [markerImage sd_setImageWithURL:[NSURL URLWithString:[ann.infoDict valueForKey:@"zone_mapicon"]] placeholderImage:[UIImage imageNamed:@"pinImage"] options:SDWebImageRefreshCached];

    ann.iconView = markerImage;
      ann.map = self.mapkitView;