0

我正在使用 php 和 html-5 开发一个网站,我的计划是在给定的 JPEG 图像上显示两个位置之间的动态路线,我们该怎么做,我不知道在网站上使用 GPS 系统,我会喜欢一些帮助..

谢谢

4

2 回答 2

0

请参阅这篇 W3Schools 文章:http ://www.w3schools.com/html/html5_geolocation.asp

if(!navigator.geolocation){
  //the browser does not support geolocation
}else{
  (function getPosition(){
    navigator.geolocation.getCurrentPosition(
      function (position){
        //use the coordinates
        balloon.style.left = (position.coords.latitude - latMin) * latScale;
        balloon.style.top = (position.coords.longitude - longMin) * longScale;
        //requery the position after a set time
        setTimeout(getPosition,1000);
      }
    )
  })()
}
于 2012-10-19T07:51:14.733 回答
0

好文章在这里:

http://merged.ca/iphone/html5-geolocation

if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition( 

    function (position) {  

    // Did we get the position correctly?
    // alert (position.coords.latitude);

    // To see everything available in the position.coords array:
    // for (key in position.coords) {alert(key)}

    alert(position.coords.latitude + ',' + position.coords.longitude);

    }, 
    // next function is the error callback
    function (error)
    {
        switch(error.code) 
        {
            case error.TIMEOUT:
                alert ('Timeout');
                break;
            case error.POSITION_UNAVAILABLE:
                alert ('Position unavailable');
                break;
            case error.PERMISSION_DENIED:
                alert ('Permission denied');
                break;
            case error.UNKNOWN_ERROR:
                alert ('Unknown error');
                break;
        }
    }
    );
}

}

于 2012-10-19T08:03:35.053 回答