2

So currently I have a map that has some plane data. There is a setInterval function that updates the plane data every 5 seconds, making the plane move from point to point. That is working well.

function planeInterval() {
    setInterval(function() {planeMovement()}, 5000);
    //this is currently working
}

function planeMovement() {
    //do some stuff to make the plane move around
    //this is currently working

}

Now, I would like to set up a checkbox or some sort of toggle to:

-toggle on: as the plane moves across the map, the map MOVES as the plane moves

-toggle off: the plane just does what it usually does: moves across the map while the map stays stagnant.

I was looking into OL panTo but I don't think that's the answer here. What would be the best/most simple approach in achieving this?

4

Set the center of the map to the airplane position after it has refreshed.

OpenLayers setCenter

  • Right right, of course I made it more complicated/overthought it. Thanks for the reply, it worked. – Nubtacular Nov 8 '13 at 22:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.