1

In my application I have an MapView with autocomplete. When user selects some place I show a pin on the map view with details button. Then I want to show a static satellite image of the place the same as Apple's map application does it.

Are there some ways I can do this?

MainstreamDeveloper00
  • 8,436
  • 15
  • 56
  • 102

2 Answers2

3

If you want to create a static image of the selected place on the MapView, you can use MKMapSnaphotter class for this purpose with satellite map type. When you click on the details button, pass MKSnapshotOptions to your detail view controller like this:

MKMapSnapshotOptions *options = [MKMapSnapshotOptions new];
options.region = mapView.region;
options.size =  mapView.frame.size;
options.mapType = MKMapTypeSatellite;
options.showsBuildings = YES;
options.scale = [[UIScreen mainScreen] scale];
detailViewController.options = options;

And then in your detail view controller create a snapshot image and show it like this:

 MKMapSnapshotter *snapshotter = [[MKMapSnapshotter alloc] initWithOptions:self.options];
[snapshotter startWithCompletionHandler:^(MKMapSnapshot *snapshot,    NSError *error) {
    if (error) return; //And show error message;
    imageView.image = snapshot.image;
}];
Oleksandr Karaberov
  • 12,573
  • 10
  • 43
  • 70
0

MKMapView has a property mapType. Set this property to MKMapType.Satellite.

Possible types are:

  • Standard
  • Satellite
  • Hybrid

See mapType in MKMapView Class Reference

zisoft
  • 22,770
  • 10
  • 62
  • 73