地图API引发的设想
如今的地圖API接口相當(dāng)?shù)呢S富,只要花上半天的時(shí)間,就可以制作出與Google地圖相差無(wú)幾的地圖頁(yè)面,不得不說(shuō)是Google打開了人們對(duì)于地圖及GIS的認(rèn)識(shí),現(xiàn)在有很多的地圖API可供使用,Bing地圖、MapABC地圖……當(dāng)然其中不乏像谷歌百度這樣免費(fèi)的地圖接口。
Google Map API V3版本開始不再使用那煩人的Key,百度地圖API雖然是測(cè)試版,但也一樣無(wú)需申請(qǐng)Key??赐耆缦碌睦?#xff0c;你會(huì)發(fā)現(xiàn)他們有著非常相似的地方。
------------------------------------------------------------------------------------------------------------------------------------------------
File:Google.htm
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
??? <title></title>
??? <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
??? <script type="text/javascript">
??????? var map;
??????? function initialize() {
??????????? var myOptions = {
??????????????? zoom: 15,
??????????????? center: new google.maps.LatLng(28.673850794185323, 115.90456195259094),
??????????????? mapTypeId: google.maps.MapTypeId.ROADMAP
??????????? };
??????????? map = new google.maps.Map(document.getElementById('map'), myOptions);
??????????? //綁定地圖單擊
??????????? if (map != null)
??????????? {
??????????????? google.maps.event.addListener(map, 'click', function(e) {
??????????????????? document.getElementById("text").innerHTML = e.latLng;
??????????????? });
??????????? }
??????? }
??????? google.maps.event.addDomListener(window, 'load', initialize);
??? </script>
??? <style type="text/css">
??????? .map { position: absolute; z-index: 2; background: #e1e1e1; top: 0px; left: 0px; right: 0px; bottom: 0px; }
??? </style>
</head>
<body>
??? <div class="map" id="map">
??? </div>
??? <div id="text" style="position: absolute; z-index: 10; border: solid 3px #e1e1e1; top: 20px; left: 350px; width: 300px; height: 30px; background: #e1e1e1;">
??? </div>
</body>
</html>
------------------------------------------------------------------------------------------------------------------------------------------------
File:BaiDu.htm
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
??? <title></title>
??? <script type="text/javascript" src="http://api.map.baidu.com/api?v=1.2"></script>
??? <script type="text/javascript">
??????? var map;
??????? function initialize() {
??????????? // 創(chuàng)建地圖實(shí)例
??????????? map = new BMap.Map("map");
??????????? // 創(chuàng)建點(diǎn)坐標(biāo)
??????????? var point = new BMap.Point(115.90456195259094, 28.673850794185323);
??????????? // 初始化地圖,設(shè)置中心點(diǎn)坐標(biāo)和地圖級(jí)別?
??????????? map.centerAndZoom(point, 15);
??????????? map.addControl(new BMap.NavigationControl());
??????????? map.addControl(new BMap.ScaleControl());
??????????? map.addControl(new BMap.OverviewMapControl());
??????? };
??????? window.onload = function() { initialize(); };
??? </script>
??? <style type="text/css">
??????? .map { position: absolute; z-index: 2; background: #e1e1e1; top: 0px; left: 0px; right: 0px; bottom: 0px; }
??? </style>
</head>
<body>
??? <div class="map" id="map">
??? </div>
</body>
</html>
------------------------------------------------------------------------------------------------------------------------------------------------
簡(jiǎn)簡(jiǎn)單單的數(shù)行相似的代碼,體現(xiàn)了API開發(fā)團(tuán)隊(duì)的強(qiáng)悍,這也引發(fā)了一個(gè)問(wèn)題,程序員們已經(jīng)無(wú)法從這些API中獲取更加底層更加細(xì)微的信息,大家開始不再關(guān)心細(xì)節(jié),這使得廣大的GISER們無(wú)心再去研究原理性的東西,這樣發(fā)展的后果相當(dāng)恐怖……
相比于成熟的國(guó)內(nèi)外GIS系統(tǒng),免費(fèi)或開源GIS更加受到歡迎,這些古老的成熟的GIS系統(tǒng)會(huì)不會(huì)因此而沒落呢……
轉(zhuǎn)載于:https://www.cnblogs.com/GISZL/archive/2011/11/14/2249025.html
總結(jié)
以上是生活随笔為你收集整理的地图API引发的设想的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: VMWare下的DOS与宿主机的文件共享
- 下一篇: smarty2和smarty3