AGSMapView maxExtent?

Discussion created by Tomsky on May 3, 2017

I am loading a vector tile package in a map view with:


@IBOutlet weak var mapView: AGSMapView!

    @IBOutlet var mapScale: UILabel!

    private var map:AGSMap!



    func configureView() {

        if let detail = self.detailItem {

            self.title = detail.lastPathComponent


            let vectorTiledLayer = AGSArcGISVectorTiledLayer(url: detail)


            vectorTiledLayer.load(completion: {(error) -> Void in

                if let error = error {

                    print("Error :", error.localizedDescription)


                else {

           = AGSMap(basemap: AGSBasemap(baseLayer: vectorTiledLayer))








I found out to prevent the user from panning away form the vector tile package through the whole world (grey area) with: 

self.mapView.wrapAroundMode = .disabled


But how can I make sure the user cannot pan outside the "map bounds" like:

let mapExtend = AGSGeometryEngine.projectGeometry(self.vectorTiledLayer.fullExtent!, to: AGSSpatialReference.wgs84()) as? AGSEnvelope


My plan is to not show any grey raster outside my vtpk on iPhone and iPad

Thank you for any help