我有一個web應用程序。我想集成Google地圖,以顯示用戶在搜索位置鍵入的位置的地圖。任何幫助?如何將Google地圖集成到Web應用程序中?
4
A
回答
3
如果我正確理解你的問題,你希望你的用戶搜索一個位置,然後顯示它在地圖上。如果是這種情況,那麼可以使用Google Maps JavaScript API提供的Geocoding Services很容易地完成。請看下面的例子:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps Geocoding Demo</title>
<script src="http://maps.google.com/maps/api/js?sensor=false"
type="text/javascript"></script>
</head>
<body>
<div id="map" style="width: 400px; height: 300px;"></div>
<script type="text/javascript">
var address = 'London, UK';
var map = new google.maps.Map(document.getElementById('map'), {
mapTypeId: google.maps.MapTypeId.TERRAIN,
zoom: 6
});
var geocoder = new google.maps.Geocoder();
geocoder.geocode({
'address': address
},
function(results, status) {
if(status == google.maps.GeocoderStatus.OK) {
new google.maps.Marker({
position: results[0].geometry.location,
map: map
});
map.setCenter(results[0].geometry.location);
}
else {
// Google couldn't geocode this request. Handle appropriately.
}
});
</script>
</body>
</html>
截圖:
你可以簡單地替代address
變量,在這個例子中設置爲'London, UK'
由用戶搜索的位置的值。
0
第1步:打開你想嵌入的地圖。它可以是您在地圖標籤下創建的地圖,也可以是地址,本地商戶或駕車路線搜索。
第2步:單擊「鏈接到此頁面」後,從文本框中複製HTML代碼。您還可以在嵌入之前自定義地圖的大小並預覽它。
第3步:將HTML代碼粘貼到您的網站或您的博客編輯器中。
否則請參閱本網站 http://www.higheredblogcon.com/library/deweese/presentation.html
0
你所需要的是
地理編碼(一個辦法把地址提供給長,LAT) http://code.google.com/apis/ajax/playground/#geocoding_simple
和一張簡單的地圖 http://code.google.com/apis/ajax/playground/#map_simple
相關問題
- 1. 如何將新的Google地圖應用程序與ios應用程序集成
- 2. 將免費地圖集成到Web應用程序
- 3. 如何將asp.net web應用程序與Google Drive集成?
- 4. 如何將Google文檔集成到Node.js的Web應用程序中?
- 5. 如何將Google翻譯集成到基於Web的聊天應用程序中?
- 6. 如何將Google憑證集成到iPhone應用程序中?
- 7. 如何將Google +集成到我的Android應用程序中?
- 8. 如何將Google Earth API集成到桌面應用程序中?
- 9. 如何將Google Checkout集成到我的Android應用程序中?
- 10. 如何將R集成到Web應用程序中
- 11. 如何將RapidMiner集成到PHP Web應用程序中?
- 12. 如何將Sharepoint Blog集成到ASP.NET Web應用程序中?
- 13. 將Google圖片集成到應用程序中
- 14. 如何在Android2.1中將Google地圖與我的應用程序集成?
- 15. 如何將Photoshop中製作的地圖與ASP.NET Web應用程序集成?
- 16. 將web應用程序與ios谷歌地圖集成
- 17. 如何將Google App Engine集成到現有的Web應用程序?
- 18. 我們可以將QGIS地圖集成到Web應用程序中嗎?
- 19. 將Google地圖集成到離子中
- 20. 將Bing地圖集成到iPhone應用程序中
- 21. Google Calender Api使用API調用集成到web應用程序
- 22. 如何集成Web應用程序
- 23. 在柔性web應用程序中的谷歌地圖集成
- 24. 如何將蘋果地圖與iphone應用程序集成
- 25. 如何將Bing地圖與離線WP7應用程序集成
- 26. 將OBIEE與Web應用程序集成
- 27. 將IMCache與Web應用程序集成
- 28. 如何將Microsoft Bing地圖導航功能集成到iPhone應用程序中?
- 29. DevExpress集成到.Net Web應用程序
- 30. 需要將Google身份驗證集成到我的Web應用程序中
要顯示您公司的位置? – sathish 2010-07-17 08:30:23
不完全。該位置是用戶願意通過地圖看到的東西。我不想透露更多細節,因爲它是保密的。 – 2010-07-17 08:34:36