GraphHopper.com | Forum | GitHub | Maps | Blog

iOS - PointOutOfBoundsException


#1

Hi,
I followed all the instructions in documentation for iOS. I created a sample project and build it,everything is good,but when i want to draw a route between two points it returns PointOutOfBoundsException.

My code looks like:

 func getResult(startPos: NTMapPos, stopPos: NTMapPos) -> GHResponse? {
        var result: GHResponse?
        let request : GHRequest?
        
        let latitudStart84 = projection.toWgs84(startPos).getX()
        let longitudStart84 = projection.toWgs84(startPos).getY()
        
        let latitudStop84 = projection.toWgs84(stopPos).getX()
        let longitudStop84 = projection.toWgs84(stopPos).getY()
    
        request = GHRequest(double: latitudStart84, with: longitudStart84, with: latitudStop84, with: longitudStop84).setVehicleWith("car").setWeightingWith("fastest").setLocaleWith("es")
        
        result = self.hopper?.route(with: request)
        
        var routeInfo : String = ""

        if (result?.hasErrors())! {
            print("\(result!.getErrors())")
            routeInfo = routeInfo + ("\(result?.getErrors())\n")
            return nil
        }
        return result
    }

this is the output from
hopper!.getStorage().getBounds()
bbox -84.95140079300256,-74.1349141851421,19.838408265376277,23.22327602408698

and this are the point

Printing description of latitudStart84:
-82.473591080779372
Printing description of longitudStart84:
22.926164394980436
Printing description of latitudStop84:
-82.472904432575049
Printing description of longitudStop84:
22.985913559842867

Can any one help me? Please?