0

I am currently working in Swift 3 and I ran into problems trying to create a flag splitting project for an app I am helping create in my Grade 12 programming class. I was trying to have a polyline splitting two maps. An example is pictured/attached below. I have been trying to find a way to have the polyline on the same layers as the flags. I have been able to get the polyline to show up on its own layer but haven’t been able to figure out a way to create a complex polygon that the flag image will go into like the picture bellow.

Map Example

What I’ve tried: I’ve searched through Google and stackoverflow but unfortunately I have been unable to find a similar project

I can add an annotation/UIImage to the map however the image goes overtop the polyline.

David Makogon
  • 69,407
  • 21
  • 141
  • 189

1 Answers1

0

I do not know an easy answer to your question that I think is appropriate for a 12th grade assignment. You can mask an image with another image or with a shape by using either UIView's mask property or CALayer's mask property. The difficulty is that each of these requires that you have either the geometry or image for the mask and I'm not sure that there is an easy way to get this from the mapView. There is one solution here, but you will need to convert all of the coordinates from lat long into screen coordinates for it to work

Community
  • 1
  • 1
Josh Homann
  • 15,933
  • 3
  • 30
  • 33