AGSMapView maxExtent?

638
0
05-03-2017 01:57 PM
ThomasArnold
New Contributor II

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 {

                    self.map = AGSMap(basemap: AGSBasemap(baseLayer: vectorTiledLayer))

                    

                    self.mapView.map = self.map                 

                }

            })

        }

    }

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

Thomas

0 Kudos
0 Replies