Questions tagged [mkpolygon]

The MKPolygon class (iOS Developer Library) represents a shape consisting of one or more points that define a closed polygon

The MKPolygon class represents a shape consisting of one or more points that define a closed polygon. The points are connected end-to-end in the order they are provided. The first and last points are connected to each other to create the closed shape.

When creating a polygon, you can mask out portions of the polygon by specifying one or more interior polygons. For the polygons you specify, this class uses the even-odd fill rule to determine the final occupied area. When applied to overlapping polygons, this rule can cause specific regions to be masked out (and thereby removed) from the total occupied area.

68 questions
2
votes
0 answers

Convert UIBezierPath to MKPolygon?

How can one convert a UIBezierPath to a MKPolygon? Background: I wish to create an overlay for an map (MKMapKit) that includes shapes with components of a circle (i.e. arc). I see that I can create a path that includes circle arcs in the Core…
Greg
  • 34,042
  • 79
  • 253
  • 454
2
votes
1 answer

Swift 2 - User's Current Location is inside MKPolygon

I am trying to check if the user's current location is inside the MKPolygon. I have created the following function but it returns false for all my test cases. Is there something I might be doing wrong? func isCorrectRegion(coordinates: Array,…
samk
  • 31
  • 4
2
votes
5 answers

MKPolygon - How to determine if a CLLocationCoordinate2D is in a CLLocationCoordinate2D polygon?

I have the swift code below that draws a polygon and drops an annotation on MKMapView. I am trying to figure out how i could identify if the annotation's coordinate is within the polygon? import UIKit import MapKit class ViewController:…
Sicong Liu
  • 113
  • 1
  • 2
  • 7
2
votes
0 answers

MKPolygon Intersection Point

I'm drawing a polygon on an MKmapView like this: CLLocationCoordinate2D points2[[swaping count]]; points2[0] = CLLocationCoordinate2DMake([[[swaping objectAtIndex:0] valueForKey:@"lat"] doubleValue], [[[swaping objectAtIndex:0] valueForKey:@"lng"]…
user3419170
  • 97
  • 10
2
votes
0 answers

Drawing mulitple MKpolygons in a single

I'm using a MKMapView to display a map with a bunch of MKPolygons on it. It can at times end up drawing 1000+ MKPolygons and is starting to affect performance. Is there a way to draw the polygons on the map more efficiently? Can I draw them all in a…
Padin215
  • 7,444
  • 13
  • 65
  • 103
2
votes
1 answer

MKMapView overlays redraw(blink) when adding new overlays. MKPolyLines are jagged

I am testing out some basic drawing functionality on a MKMapView and i am getting some strange things happening. You can refer to the dropbox link that is below. This is being run and tested on an actual device - not the simulator. You will notice…
cspam
  • 2,911
  • 2
  • 23
  • 41
1
vote
1 answer

How to draw a polygon using Apple Map by MKPolygon

I'm creating a polygon with the help of the below coordinates. Polygon appears fine on the map but I'm wondering about the shape of the polygon. In the below code, I've written to draw a polygon. let points1 =…
sandeep tomar
  • 303
  • 1
  • 5
  • 17
1
vote
2 answers

How can I draw two MKPolygons on MapView without having them connect?

For some reason, when I try to draw two MKPolygons on a mapView (MKMapView) I end up with the two polygons connected. Drawing each polygon individually works fine. And I've verified that each of the polygons don't contain any of the coordinates to…
kevlar924
  • 55
  • 1
  • 1
  • 6
1
vote
0 answers

Find nearest point on a MKPolygon from a CLLocationCoordinate2D

I have a series of coordinates which forms a MKPolygon. I have another coordinate say user location. Now I need to find the nearest point from the user location to the polygon to show the shortest distance from the user location to polygon. In my…
prabhu
  • 1,158
  • 1
  • 12
  • 27
1
vote
0 answers

Multiple colored MKPolygon Overlays are creating a memory leak

I'm, developing an app that needs different colored overlays for "delivery zones" so basically what I did was to subclass MKPolygon depending on the color I needed. class YellowPolygon: MKPolygon { } class BluePolygon: MKPolygon { } class…
Octavio Rojas
  • 187
  • 13
1
vote
0 answers

Detect click on MKPolygon overlay

I have been trying to work out if a tap gesture is in an overlay polygon, to no avail. I am trying to make a map of country overlays - on clicking on an overlay I want to be able to tell what country the overlay is of. First I found this: Detecting…
Anna
  • 121
  • 1
  • 7
1
vote
1 answer

MKPolygon Swift not appearing

Im trying to create a shape on my map but I'm having a hard time finding any information about mkpolygon with swift. I was hoping someone on here would see this and point me into the right direction. This is what I currently have but the polygon is…
Thomas rocks
  • 111
  • 1
  • 1
  • 13
1
vote
1 answer

GEOSwift and MapviewOverlays (Swift)

ViewController.swift import UIKit import MapKit import GEOSwift class ViewController: UIViewController, MKMapViewDelegate { @IBOutlet weak var mapView: MKMapView! override func viewDidLoad() { mapView.delegate = self super.viewDidLoad() …
1
vote
1 answer

How create MKPolyline and MKPolygon with Swift?

I need create menu with adding polyline or polygon on Map. I know how render MKPolyline and MKPolygon with list of annotations, but I don't know how create with gestures. Thanks for help.
Z.S.
  • 39
  • 1
  • 9
1
vote
2 answers

Check if user location is inside a shape

I made this method to check if an user location is inside a polygon on a map view (mapkit). I pass to the method the current user location (CLLocationCoordinate2D) and return a boolean just to know if the user is in a polygon or not. func…
djoosi
  • 236
  • 2
  • 9