2017-05-04 13 views
-1

我是一個業餘網頁開發人員(業餘我的意思是非常低的初學者水平)。我在一家旅行社工作,我們最近開始實施的谷歌地圖API到我們的頁面,這樣就可以顯示的旅館,飯店等的地圖位置無論如何只有導入的數據才能得到空白的地圖嗎?

不幸的是,大部分都已經通過谷歌上市,任何人都可以點擊「在谷歌地圖中查看「選項,並獲得直接聯繫詳細信息(這是我們試圖避免,因爲我們的佣金工作。)

有什麼辦法可以得到一個空白的地圖,因此它只顯示我們繪製的點?

如果有幫助,我目前使用與標籤上的標記的JavaScript與API

+0

可能重複[我們怎樣才能設置谷歌地圖,只有我們的酒店信息?(http://stackoverflow.com/questions/13621632 /如何設置Google地圖 - 僅 - 我們的酒店信息) – geocodezip

+0

[Google Maps API Click Point Marker(非自定義)](http:// stackoverflow。 COM /問題/ 13466805 /谷歌地圖的API,點擊點標記不定製) – geocodezip

回答

2

你的意思是,你需要刪除「標籤」,並從地圖右側的所有額外信息。 你可以添加一些樣式到你的谷歌地圖腳本。 這裏是完整的代碼映射與我的信息。 它可能有幫助。 你可以改變等多種色彩款式,如果你需要的

<!DOCTYPE html> 
<html> 
    <head> 
     <title>Google map test demo</title> 

     <style type="text/css"> 
     /* Set a size for our map container, the Google Map will take up 100% of this container */ 
     #map { 
      width: 750px; 
      height: 500px; 
     } 
     </style> 

     <!-- 
     You need to include this script tag on any page that has a Google Map. 

     The following script tag will work when opening this example locally on your computer. 
     But if you use this on a localhost server or a live website you will need to include an API key. 
     Sign up for one here (it's free for small usage): 
      https://developers.google.com/maps/documentation/javascript/tutorial#api_key 

     After you sign up, use the following script tag with YOUR_GOOGLE_API_KEY replaced with your actual key. 
      <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=YOUR_GOOGLE_API_KEY"></script> 
    --> 
    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js"></script> 

    <script type="text/javascript"> 
     // When the window has finished loading create our google map below 
     google.maps.event.addDomListener(window, 'load', init); 

     function init() { 
      // Basic options for a simple Google Map 
      // For more options see: https://developers.google.com/maps/documentation/javascript/reference#MapOptions 
      var mapOptions = { 
       // How zoomed in you want the map to start at (always required) 
       zoom: 11, 

       // The latitude and longitude to center the map (always required) 
       center: new google.maps.LatLng(40.6700, -73.9400), // New York 

       // How you would like to style the map. 

       styles: [{"elementType":"labels.text","stylers":[{"visibility":"off"}]},{"featureType":"landscape.natural","elementType":"geometry.fill","stylers":[{"color":"#f5f5f2"},{"visibility":"on"}]},{"featureType":"administrative","stylers":[{"visibility":"off"}]},{"featureType":"transit","stylers":[{"visibility":"off"}]},{"featureType":"poi.attraction","stylers":[{"visibility":"off"}]},{"featureType":"landscape.man_made","elementType":"geometry.fill","stylers":[{"color":"#ffffff"},{"visibility":"on"}]},{"featureType":"poi.business","stylers":[{"visibility":"off"}]},{"featureType":"poi.medical","stylers":[{"visibility":"off"}]},{"featureType":"poi.place_of_worship","stylers":[{"visibility":"off"}]},{"featureType":"poi.school","stylers":[{"visibility":"off"}]},{"featureType":"poi.sports_complex","stylers":[{"visibility":"off"}]},{"featureType":"road.highway","elementType":"geometry","stylers":[{"color":"#ffffff"},{"visibility":"simplified"}]},{"featureType":"road.arterial","stylers":[{"visibility":"simplified"},{"color":"#ffffff"}]},{"featureType":"road.highway","elementType":"labels.icon","stylers":[{"color":"#ffffff"},{"visibility":"off"}]},{"featureType":"road.highway","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"road.arterial","stylers":[{"color":"#ffffff"}]},{"featureType":"road.local","stylers":[{"color":"#ffffff"}]},{"featureType":"poi.park","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"poi","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"water","stylers":[{"color":"#71c8d4"}]},{"featureType":"landscape","stylers":[{"color":"#e5e8e7"}]},{"featureType":"poi.park","stylers":[{"color":"#8ba129"}]},{"featureType":"road","stylers":[{"color":"#ffffff"}]},{"featureType":"poi.sports_complex","elementType":"geometry","stylers":[{"color":"#c7c7c7"},{"visibility":"off"}]},{"featureType":"water","stylers":[{"color":"#a0d3d3"}]},{"featureType":"poi.park","stylers":[{"color":"#91b65d"}]},{"featureType":"poi.park","stylers":[{"gamma":1.51}]},{"featureType":"road.local","stylers":[{"visibility":"off"}]},{"featureType":"road.local","elementType":"geometry","stylers":[{"visibility":"on"}]},{"featureType":"poi.government","elementType":"geometry","stylers":[{"visibility":"off"}]},{"featureType":"landscape","stylers":[{"visibility":"off"}]},{"featureType":"road","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"road.arterial","elementType":"geometry","stylers":[{"visibility":"simplified"}]},{"featureType":"road.local","stylers":[{"visibility":"simplified"}]},{"featureType":"road"},{"featureType":"road"},{},{"featureType":"road.highway"}] 
      }; 

      // Get the HTML DOM element that will contain your map 
      // We are using a div with id="map" seen below in the <body> 
      var mapElement = document.getElementById('map'); 

      // Create the Google Map using our element and options defined above 
      var map = new google.maps.Map(mapElement, mapOptions); 

      // Let's also add a marker while we're at it 
      var marker = new google.maps.Marker({ 
       position: new google.maps.LatLng(40.6700, -73.9400), 
       map: map, 
       title: 'test!' 
      }); 
     } 
    </script> 
</head> 
<body> 
    <!-- The element that will contain our Google Map. This is used in both the Javascript and CSS above. --> 
    <div id="map"></div> 
</body> 

相關問題