Making the mobile application interactive

In the final example, called ch08_interact, we extend the touch device part of our application and make it more interactive. We want to know our heading when we search for geocaches. Furthermore, it would be a nice feature if our application could give some extra information about a given cache that we could select manually.

Firstly, we extend our listener on the Geolocation object's change event with some necessary modifications. As we would like to track our position and heading, we modify our map's view on every change:

geoloc.on('change', function (evt) {
        […]
        map.getView().setCenter(this.getPosition());
        if (this.getHeading()) {
            map.getView().setRotation(this.getHeading());
        }

Tip

Just like an altitude value, ...

Get Mastering OpenLayers 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.