graphhopper / graphhopper-ios

iOS Port of the GraphHopper road routing engine
https://www.graphhopper.com/open-source/
Apache License 2.0
69 stars 28 forks source link

graphhopper-ios getHints() and instruction #22

Closed tnmendes closed 7 years ago

tnmendes commented 7 years ago

In android we can request getHints() and the instruction, in iOS i saw that the code is graphhopper but is not allowed to used.

Do someone know how to request the array with the instruction in iOS?

thanks in advance

randyhbh commented 7 years ago

i get the instructions in ios, using swift 3 like this

let path : PathWrapper = result.getBest()
let instructions : InstructionList = path.getInstructions()
 let count = instructions.size()

        for i in stride(from: 0, to: count, by: 1) {
            let instruction : Instruction = instructions.getWith(i)
            let cantPointInstruction = instruction.getPoints().size()

            var j : jint = 0
            while j < cantPointInstruction {
                let xLongitud = instruction.getPoints().getLongitudeWith(j)
                let yLatitud = instruction.getPoints().getLatitudeWith(j)

                let position = projection.fromWgs84(NTMapPos(x: xLongitud, y: yLatitud))

                // in do something with the instruction position and the instruction  

                j += 1
            }     
        }
karussell commented 7 years ago

@tnmendes Questions go better into our forum (closing for now). Thanks @RandyHBH for providing help here (I guess this is swift?).

randyhbh commented 7 years ago

@karussell yes it is swift.

tnmendes commented 7 years ago

@RandyHBH Thank you, I'll see if in the next few days I'll try that.