插件100:显示bing地图

<?php // Plug-in 100: Display Bing Map
/*
* 显示bing地图
* 插件说明:
* $lat 某个位置的纬度
* $long 某个位置的经度
* $zoom 放大倍数(0表示没放大,19表示最大放大倍数)
* $style 地图的样式,去Road或Aerial之一(Road表示交通图,Aerial表示航拍图,必须与他们一直)
* $width 地图的宽度
* $height 地图的高度
*/
// This is an executable example with additional code supplied
// To obtain just the plug-ins please click on the Download link

$result = PIPHP_DisplayBingMap(40.68913, -74.0446, 18, 'Aerial',
   300, 214);

$text = "<b>The Statue of Liberty</b>, officially titled " .
        "Liberty Enlightening the World, is a monument that " .
        "was presented by the people of France to the United " .
        "States of America in 1886 to celebrate its " .
        "centennial. Standing on Liberty Island in New York " .
        "Harbor, it welcomes visitors, immigrants, and " .
        "returning Americans traveling by ship. The copper-" .
        "clad statue, dedicated on October 28, 1886, " .
        "commemorates the centennial of the signing of the " .
        "United States Declaration of Independence and was " .
        "given to the United States by France to represent " .
        "the friendship between the two countries " .
        "established during the American Revolution.";

echo "<table width='300' height='214' align=left><tr><td>" .
     $result . "</td></tr></table><p align='justify'>$text";

function PIPHP_DisplayBingMap($lat, $long, $zoom, $style,
   $width, $height)
{
   // Plug-in 100: Display Bing Map (Updated)
   //
   // This plug-in takes the contents of $contents and places it
   // inside a table to which it gives rounded borders. It
   // requires these arguments:
   //
   //    $lat:    Latitude of the location to display
   //    $long:   Longitude of the location to display
   //             These may be obtained by visiting the URL:
   //                http://www.hmmm.ip3.co.uk/longitude-latitude
   //    $zoom:   The zoom level between 0 (minimum zoom) and
   //             19 (maximum zoom)
   //    $style:  One of Aerial or Road (exact spelling required)
   //    $width:  Width of map
   //    $height: Height of map

   if ($style != 'Aerial') $style = 'Road';

   $width  .= 'px';
   $height .= 'px';

   $root = 'http://ecn.dev.virtualearth.net/mapcontrol';
   return <<<_END
<script src="$root/mapcontrol.ashx?v=6.2"></script>
<script>
if (window.attachEvent)
{
   window.attachEvent('onload',   Page_Load)
   window.attachEvent('onunload', Page_Unload)
}
else
{
   window.addEventListener('DOMContentLoaded', Page_Load, false)
   window.addEventListener('unload', Page_Unload, false)
}

function Page_Load()
{
   GetMap()
}  

function Page_Unload()
{
   if (map != null)
   {
      map.Dispose()
      map = null
   }
}

function GetMap()
{
   map = new VEMap('PIPHP_DBM')
   map.LoadMap(new VELatLong($lat, $long),
      $zoom, VEMapStyle.$style, false)
}
</script>
<div id='PIPHP_DBM' style="position:relative;
   width:$width; height:$height;"></div>
_END;
}

?>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值