Geolocation issue with Speed -
i trying display user's location , speed on map. code correctly display location displays speed if first move map centre user's location. prefer not move map , want display speed location.
am missing in code below?
function showposition(position) { speedlat = (position.coords.latitude).tofixed(3) speedlng = (position.coords.longitude).tofixed(3) rawspeed = position.coords.speed; //rawspeed = 2.2352; // test figure of 5 mph speedmph = (rawspeed * 2.2369362920544).tofixed(2); // conversions m/s speedkph = (rawspeed * 3.6).tofixed(2); speedknts = (rawspeed * 1.9438444924574).tofixed(2); mph = "speed in mph: " + speedmph; // set display results kph = "speed in kph: " + speedkph; knt = "speed in knots: " + speedknts; document.getelementbyid('showmph').innerhtml = speedmph; // populate popup results document.getelementbyid('showkph').innerhtml = speedkph; document.getelementbyid('showknts').innerhtml = speedknts; document.getelementbyid('showlat').innerhtml = speedlat; document.getelementbyid('showlng').innerhtml = speedlng; myapp.popup('.popup-speed'); // show speeds/location in popup }
Comments
Post a Comment