Although there is no integrated support for this, you can do a workaround.
The file here should replace the file from the Public SDK demo application to view the workaround (MapDisplayViewController.m).
The idea is that you can get information about the limited space of a city / country from the Maps.json provided by us. Then you need to implement the following callback:
- (void)mapView:(SKMapView *)mapView didChangeToRegion:(SKCoordinateRegion)region { if (self.bbox) { if ([self.bbox containsLocation:region.center]) { self.previousRegion = region; } else { [self.mapView animateToLocation:self.previousRegion.center withDuration:0.2]; } } }
This implementation ensures that when the user leaves the city / country field, he will be transferred back to the previous region contained in the bounding box.
Limitations of the zoom level: restriction of the zoom level is possible through the zoomLimits property for SKMapsSettings:
SKMapZoomLimits zoomLimits; zoomLimits.mapZoomLimitMin = 5.0f; zoomLimits.mapZoomLimitMax = 14.0f; self.mapView.settings.zoomLimits = zoomLimits;
source share