map24根据经纬度查找地方

来源:互联网 发布:php eol 有什么用处 编辑:程序博客网 时间:2024/05/18 18:20
 要使用www.map24.com的地图服务,首先必须注册并获取一个key,我的IP地址是192.168.1.6。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    
<head>
        
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
        
<title>Map Object Location</title>
        
<script type="text/javascript" language="javascript" src="http://api.maptp.map24.com/ajax?appkey=FJXc5d99b6fa10073be9b1fd334c7d11X35">
        
</script>
        
<script type="text/javascript" language="javascript">
           
            
function goMap24(){
                Map24.loadApi([
"core_api""wrapper_api"], map24ApiLoaded);
            }

            
            
function map24ApiLoaded(){
                Map24.MapApplication.init(
{
                    NodeName: 
"maparea"
                }
);
            }

            
          
            
            
function addLocation(){
                
//Create a new location. 
                myLoc = null;
                myLoc 
= new Map24.Location({
                    Longitude: document.getElementById(
"longtitude").value,
                    Latitude: document.getElementById(
"latitude").value,
                    Description: 
"Bob's ToolTip:This is a plain tooltip for the location which is visible on the interactive map.",
                    LogoURL: 
"http://img.map24.com/map24/3DSignet/signet3d22x20.gif"
                }
);               
               
                 
//Commit the location. Only after calling commit() it is possible 
                //to execute further operations on the location such as hide and show.
                myLoc.commit();
                 centerOnLocation(myLoc);
                
//Enable all buttons below the map that enable further interactions.  
                document.getElementById('button_show').disabled = false;
                document.getElementById(
'button_hide').disabled = false;
                document.getElementById(
'button_remove').disabled = false;
                document.getElementById(
'button_center').disabled = false;
            }

            
            
//Show the location if it is currently hidden.
            function showLocation(){
                myLoc.show();
            }

            
            
//Hide the location if it is currently shown.
            function hideLocation(){
                myLoc.hide();
            }

            
            
//Remove the location.
            function removeLocation(){
               myLoc.remove();
                
                
//Disable all buttons below the map that enable further interactions.    
              /** document.getElementById('button_show').disabled = true;
                document.getElementById('button_hide').disabled = true;
                document.getElementById('button_remove').disabled = true;
                document.getElementById('button_center').disabled = true;*
*/

            }

            
            
function centerOnLocation(myLoc){
                myLoc.center(
{
                    MinimumWidth: 
3034
                }
);
            }

        
</script>
    
</head>
    
<body onload="goMap24();">
        
<p>
            
<div id="maparea" style="width:700px;height:500px;background-color:#E0E0E0;">
            
</div>
        
</p>
        
<p>
           Longtitude: 
<input type="text" id="longtitude" name="longtitude" value="305.9064025878906"/>
            Latitude:
<input type="text" id="latitude" name="latitude" value="2797.95849609375" />
        
</p>
        
<input type="button" value="Add Location" onclick="addLocation();"/>
        
<input id="button_show" type="button" value="Show Location" onclick="showLocation();" disabled="disabled"/>
        
<input id="button_hide" type="button" value="Hide Loction" onclick="hideLocation();" disabled="disabled"/>
        
<input id="button_remove" type="button" value="Remove Location" onclick="removeLocation();" disabled="disabled"/>
        
<input id="button_center" type="button" value="Center" onclick="centerOnLocation();" disabled="disabled"/>
    
</body>
</html>
原创粉丝点击