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
3
votes
1 answer

Swift MapKit - create a polygon

I am trying to create a polygon on my map to show a boundry. But when I run my app nothing appears. I can see the map but not the polygon What's my error? thanks. import UIKit import MapKit import CoreLocation class MapScreen :…
l.b.dev
  • 151
  • 3
  • 10
3
votes
2 answers

Validate if a latlong is inside a MKPolygon in iOS

I'm validating whether a latlong(CLLocationCoordinate2D) is inside a MKPolygon which is drawn on the MKMapview. I'm using below code to draw MKPolygon on a MKMapview, MKPolygon *polygon = [MKPolygon polygonWithCoordinates:coordinates…
Nazik
  • 8,696
  • 27
  • 77
  • 123
3
votes
1 answer

MKPolygon initialization error "Missing argument for parameter 'interiorPolygons' in call" / "Extra argument in call"

I'm trying to convert the Objective-C code in the MapKit MKPolygon reference in Listing 6-9 into Swift. When I call the function using the init(coordinates:count:) init function, I get the error: Missing argument for parameter…
Jontonsoup
  • 171
  • 1
  • 9
3
votes
1 answer

MKOverlayRenderer not rendering

I'm having trouble getting an MKPolygonRenderer to appear over my map. I have a class MapViewController that contains an MKMapView, and create CustomMapOverlay instances to render over the MKMapView. MapViewController.m: - (void)viewDidLoad { …
ericsoco
  • 24,913
  • 29
  • 97
  • 127
3
votes
1 answer

Render Title of MKPolygon

I'm trying to render MKPolygon using the following code: NSMutableArray *overlays = [NSMutableArray array]; for (NSDictionary *state in states) { NSArray *points = [state valueForKeyPath:@"point"]; NSInteger…
mohamede1945
  • 7,092
  • 6
  • 47
  • 61
3
votes
1 answer

iOS - How to create Category with private methods

I am in the process of creating a category for the class MKPolygon. You can find the reference to this class here. I have two public class methods that I want to make "public" and a handful of "private" methods to handle some of the internals. The…
cspam
  • 2,911
  • 2
  • 23
  • 41
3
votes
3 answers

Creating a new MKPolygon from two intersecting polygons

I know that there is exactly one specific question that talks about this but its a bit old and I wanted to get a little more technical about it if possible. First of all take a look at this screenshot:…
cspam
  • 2,911
  • 2
  • 23
  • 41
2
votes
0 answers

How to prevent MKPolygons from overlapping in MKMapView

I have a set of MKPolygons to be drawn in my MKMapView but they end up overlapping each other, which brings the aspect of a patchwork, like in the image below. Is that a way to combine multiple MKPolygons into a single MKPolygon instance, merging…
marcelosalloum
  • 3,481
  • 4
  • 39
  • 63
2
votes
1 answer

iOS MKPolygon pattern

I searched over the internet but I couldn't find an answer to this. Is possible to draw polygon filled with some pattern? I don't wanna use 3rd party libraries. I would like to achieve something similar to this: polygon with pattern
P.Mol
  • 141
  • 2
  • 6
2
votes
0 answers

Swift: Convert MKPolygon to UIBeizerpath and draw path on UIView

I have a geojson file containing a FeatureCollection of Features. I parse the json with GEOSwift and end up having MKPolygon objects. I have managed to draw the polygons as overlay to the MKMapView, but the performance is really poor! The geojson…
Krueger
  • 484
  • 1
  • 5
  • 20
2
votes
1 answer

Is it possible to cluster MKPolygon on mapView in ios

I have a requirement where there are nearly hundreds of polygon data coming from API and I have to draw them quickly in the map. Right now it is taking a significant time to draw 50 polygons on map at a time. So I am thinking a way to cluster those…
Poles
  • 3,585
  • 9
  • 43
  • 91
2
votes
1 answer

How can I provide an image for an MKPolygonRenderer?

My code correctly gets an image and provides the bounds for the mapView. I want to put the image within the bounds but I am not sure how. I am able to fill it with a color but I need help making it an image. func mapView(_ mapView: MKMapView,…
user9579913
2
votes
0 answers

Sending MKShape to paramter of incompatible type id MKOverlay Nonnull

I am receiving this warning while I am overlaying the geometry on the map. Any help is greatly appreciated. Warning: "Sending MKShape to paramter of incompatible type id MKOverlay Nonnull." @interface store : NSObject @property (nonatomic, copy,…
Karen
  • 169
  • 1
  • 16
2
votes
0 answers

Swift 3 / current CLLocation inside MKPolygon without CGPath or Mapview

Full disclosure - I'm new here, but I've dug through everything and can't seem to parse together what I need. I'm at the point where Google is only returning purple links. Is there a way to check user's current CLLocation lat/lon against several…
moondog
  • 21
  • 2
2
votes
2 answers

How do I differentiate between several distinct MKPolygon overlays so I can give each one different properties?

The only way I have found to differentiate MKPolygons is by using the MKPolygon.version(Int: Int) type property. I can set this to 1,2,3 etc. and give each one a different color (for example). I wanted to extend MKPolygon to add a tag but Swift…