百度地圖API使用

百度地圖 API 使用

百度地圖提供了很是強大的 API 地圖使用,具體使用參見官方介紹:
http://developer.baidu.com/map/index.php?title=%E9%A6%96%E9%A1%B5javascript

百度地圖官網也提供了較爲詳細的使用說明可供參考,有些例子很是實用,如:
http://developer.baidu.com/map/index.php?title=jspopular/guide/cover 中介紹瞭如何使用覆蓋物,實際中常用。須要注意的一點是關於其中覆蓋物圖標 Icon 的設置在不一樣的開發環境中會有差別,若是在 Ruby on Rails 中使用,須要在 Coffeescript 文件後增長 。erb ,從而使 Coffeescript 可以使用 Helper 方法,如 <%= image_tag "" %>php

也有不少其餘資料介紹百度 API 使用,須要多多練習與琢磨。其中:
http://blog.csdn.net/sd0902/article/details/8483127 中介紹瞭如何給地圖覆蓋物增長 mouseover 方法,如當鼠標劃過期顯示某些信息:java

marker.addEventListener("mouseover", function(){this.openInfoWindow(infoWindow);});

須要補充的一點是,該方法只定義瞭如何顯示,實際中常常須要當鼠標移動至覆蓋物以外,讓信息框消失,這時就須要:api

marker.addEventListener("mouseover", function(){this.closeInfoWindow(infoWindow);});

參見:
http://developer.baidu.com/map/reference/index.php?title=Class:%E8%A6%86%E7%9B%96%E7%89%A9%E7%B1%BB/Markerjsp

相關文章
相關標籤/搜索