2017-05-04 1 views
-1

私は素人なWebデベロッパーです(素人では初心者レベルは非常に低いです)。私はツアーオペレーターで働いており、最近Google Maps APIをページに導入して、ロッジやホテルなどの地図の場所を表示することができました。インポートされたデータだけの空白の地図を取得するにはどうしますか?

残念ながら、ほとんどのものは既にGoogleを通じてリストされており、

空白の地図を取得する方法はありますか?私たちがプロットした点のみを表示する方法はありますか?

それが助け場合、私は現在、あなたが意味するAPI

+0

可能重複必要がある場合 あなたは色や他のスタイルを変更することができます[我々は唯一の私たちのホテルの情報をGoogleマップを設定することができますどのように?](http://stackoverflow.com/questions/13621632/google-map-only-our-hotel-with-hotel-information) – geocodezip

+0

[Google Maps APIクリックポイントマーカー(カスタムではない)]の可能な複製(http:// stackoverflow。 com/questions/13466805/google-maps-api-click-point-marker-not-custom) – geocodezip

答えて

2

とJavaScriptのラベルとマーカーを使用していますすることで、マップの右から「ラベル」と、すべての余分な情報を削除する必要があります。 Googleマップスクリプトにスタイルを追加することができます。 ここにmapour情報のフルコードです。 それが役に立ちます。あなたがの

<!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> 

関連する問題