mkmaprect

How to convert CGRect to MapRect

余生颓废 提交于 2019-12-23 13:57:31
问题 I created a method as below to convert a CGRect to MapRect as below - (MKMapRect)mapRectForRect:(CGRect)rect { CLLocationCoordinate2D topleft = [mapView convertPoint:CGPointMake(rect.origin.x, rect.origin.y) toCoordinateFromView:canvasView]; CLLocationCoordinate2D bottomeright = [mapView convertPoint:CGPointMake(CGRectGetMaxX(rect), CGRectGetMaxY(rect)) toCoordinateFromView:canvasView]; MKMapPoint topleftpoint = MKMapPointForCoordinate(topleft); MKMapPoint bottomrightpoint =

How to keep pin and map centered above moving overlay in an MKMapView

大城市里の小女人 提交于 2019-12-08 18:22:53
问题 How can I keep a pin centered on a map whilst I move (via Pan Gesture) another view vertically over the map such that the pin remains above the overlay (not an actual MapKit overlay). See attached screenshots for the first and final states. I've got the CGRect of the space between the overlay and the top of the screen as the user pan's up / down. However, how I use that to move the map and pin whilst zooming into the map as the user pans upward..and zoom back out again when the user pans

How to determine the correct altitude for an MKMapCamera focusing on an MKPolygon

◇◆丶佛笑我妖孽 提交于 2019-11-29 07:17:49
I need to figure out how to set up MKMapSnapshotterOptions to take a snapshot of aerial/satellite imagery associated with a polygonal region of the earth. Filling out the 'region', 'scale', 'size', and 'mapType' properties are trivial, as I have an MKPolygon to work with. The tricky part is in setting the 'camera' -- in my particular case, I am using MKMapSnapshotter independently of the MKMapView (in fact, not even on the main thread). However, I would prefer to orient the snapshot so that it fits the bounds of the polygon based on a non-zero heading -- that is, the area that I am taking a

How to determine the correct altitude for an MKMapCamera focusing on an MKPolygon

我的梦境 提交于 2019-11-28 00:44:27
问题 I need to figure out how to set up MKMapSnapshotterOptions to take a snapshot of aerial/satellite imagery associated with a polygonal region of the earth. Filling out the 'region', 'scale', 'size', and 'mapType' properties are trivial, as I have an MKPolygon to work with. The tricky part is in setting the 'camera' -- in my particular case, I am using MKMapSnapshotter independently of the MKMapView (in fact, not even on the main thread). However, I would prefer to orient the snapshot so that

Convert MKCoordinateRegion to MKMapRect

喜夏-厌秋 提交于 2019-11-26 15:27:46
问题 I have a square MKMapView in my app, and I wish to set a center point and the exact height/width of the view in meters. Creating an MKCoordinateRegion and setting the map to it (as in this code... MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(center_coord, 1000.0, 1000.0); [self.mapView setRegion:region animated:YES]; ..) doesn't work properly because using regions here just means that at least that region is displayed, typically more than the region is. I'm planning on using