Fix openlayers geolocation fix rotation issue.

Job ID: 36520271

Budget: $30 – $250 USD

I have a capacitor app which is programmed in framework7 and vue.js which uses OpenLayers and the OpenLayers geolocation system.

The app currently loads the map and displays the current location perfectly but when I turn on the map rotation to follow the heading the map rotates but the rotation is off 90 degrees and follows from left to right as you move.

I am looking for someone to fix view rotation to match the heading so it tracks correctly towards the top of the screen.

The function below is where our main issue is occuring. If you need t

self.geolocation.on( 'change:heading', self.updateCurrentHeading );

updateCurrentHeading(){
const self = this;
// H is for heading
if(self.centerLock == 'H'){
const heading = self.geolocation.getHeading();
const speed = self.geolocation.getSpeed() || 0;
// upstate only if the user is moving to prevent random rotations.
if(heading != 'undefined' && speed>=.3){
self.map.getView().setRotation( heading );
}
// N is for rotate to north
}else if( self.centerLock == 'N'){ self.map.getView().setRotation( 0 ); }
}
Related categories: JavaScript Geolocation Vue.js