AnsweredAssumed Answered

AGSRouteTask doesn't get default params (offline)

Question asked by tstorck on Dec 29, 2016
Latest reply on Jan 3, 2017 by Yue_Wu-esristaff

Hi,

 

I have an application that downloads a zip file that contains the network files, and save it in Documents application folder.

The problem is that some networks don't have the _ND_historical_traffic inside .tn folder. When this happens and i try to get the default params, i get the issue bellow:

 

Error Domain=com.esri.arcgis.runtime.error Code=3072
"The transportation network data files could not be opened, and may be missing."
UserInfo={
    Additional Message=Network_index::open_file_sections_,
    NSLocalizedFailureReason=Network_index::open_file_sections_,
    NSLocalizedDescription=The transportation network data files could not be opened,
    and may be missing.
}

 

Here my code:

 

let folderPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
let gdbPath = folderPath.appending("/network/data.geodatabase")
       
self.routeTask = AGSRouteTask(fileURLToDatabase: URL(string:gdbPath)!, networkName: "network_ND")
       
self.getDefaultParameters()
func getDefaultParameters() {
    self.routeTask.defaultRouteParameters(completion: {(params: AGSRouteParameters?, error: Error?) -> Void in
        if let error = error {
            print(error)
        }
        else {
            self.params = params
        }
    })
}

Outcomes