地图API引发的设想
如今的地圖API接口相當的豐富,只要花上半天的時間,就可以制作出與Google地圖相差無幾的地圖頁面,不得不說是Google打開了人們對于地圖及GIS的認識,現在有很多的地圖API可供使用,Bing地圖、MapABC地圖……當然其中不乏像谷歌百度這樣免費的地圖接口。
Google Map API V3版本開始不再使用那煩人的Key,百度地圖API雖然是測試版,但也一樣無需申請Key。看完如下的例子,你會發現他們有著非常相似的地方。
------------------------------------------------------------------------------------------------------------------------------------------------
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() {
??????????? // 創建地圖實例
??????????? map = new BMap.Map("map");
??????????? // 創建點坐標
??????????? var point = new BMap.Point(115.90456195259094, 28.673850794185323);
??????????? // 初始化地圖,設置中心點坐標和地圖級別?
??????????? 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>
------------------------------------------------------------------------------------------------------------------------------------------------
簡簡單單的數行相似的代碼,體現了API開發團隊的強悍,這也引發了一個問題,程序員們已經無法從這些API中獲取更加底層更加細微的信息,大家開始不再關心細節,這使得廣大的GISER們無心再去研究原理性的東西,這樣發展的后果相當恐怖……
相比于成熟的國內外GIS系統,免費或開源GIS更加受到歡迎,這些古老的成熟的GIS系統會不會因此而沒落呢……
轉載于:https://www.cnblogs.com/GISZL/archive/2011/11/14/2249025.html
總結
以上是生活随笔為你收集整理的地图API引发的设想的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: VMWare下的DOS与宿主机的文件共享
- 下一篇: smarty2和smarty3