I have a MKMapview with lot of polygons added as overlays, To optimize the memory I need to know before adding an overlay if the polygon is inside visible area of the MKMapview
I can even create a whole visible area polygon with mapview all corner coordinates, for example topLeft as below
func topLeftCoordinate() -> CLLocationCoordinate2D {
return convert(bounds.origin, toCoordinateFrom: self)
}
with all the corner coordinates, I can create a current_visible_area_polygon and I want to check the polygons I add is inside this current_visible_area_polygon.
so it comes down to two questions
- Is it possible to check if a polygon is inside another polygon or atleast intersects OR
- if a polygon is inside visible maprect