Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

19. Core Location and MapKit > Recipe: Viewing a Location

Recipe: Viewing a Location

The MKMapView class presents users with interactive maps built on the coordinates and scale you provide. The following code snippet sets a map’s region to a Core Location coordinate, showing 0.1 degrees of latitude and longitude around 1 Infinite Loop. In the United States, a region with that range corresponds to the size of a relatively small city or large town, about 5 by 7 miles. Figure 19-2 (left) shows that 0.1 degree-by-0.1 degree range on a map view.

// 1 Infinite Loop
CLLocation *location = [[CLLocation alloc]
    initWithLatitude:37.33168400 longitude:-122.03075800];
mapView.region = MKCoordinateRegionMake(
    location.coordinate, MKCoordinateSpanMake(0.1f, 0.1f));

image

Figure 19-2 A coordinate region of a tenth of a degree latitude by a tenth of a degree longitude covers an area the size of a smallish city or large town, approximately 5 to 7 miles on a side (left). Shrinking that region down to 0.005 degrees on a side produces a street-level display (right).


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial