1
    geolocation: function () {
    var self = this;
    self.geo = new ol.Geolocation({
        trackingOptions: {
            enableHighAccuracy: true
        },
        projection: self.Map.olMap.getView().getProjection()
    });
},

I have this code but if i want to get current position, i get "undefined" message.Why?

geo.getPosition() //return undefined
1
self.geo = new ol.Geolocation({
        tracking: true,
        projection: self.Map.olMap.getView().getProjection()
    });

It worked like this, but if you use like this, please wait a while when geolocation getting your lat,lon values. Its late a bit.

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.