2017-08-22 3 views
1

既存の場所/建物がなく、カスタムの場所/建物のみを使用してGoogleマップを表示する方法はありますか?既存の場所/建物がなく、カスタムの場所/建物のみを使用してGoogleマップを表示する方法はありますか?

私は道路、通り、道を保持したいと思います。しかし、建物については、私たちのデータベースからすべてのものを排他的に入手したいと考えています。

+0

[Google Maps APIの検索結果にカスタム場所を表示するにはどうすればいいですか?](https://stackoverflow.com/questions/23824133/how-to-display-custom-places-in-google-maps-api) -の検索結果) – DeKaNszn

答えて

1

スタイルを使用してマップ上の特定の機能を非表示にすることができます。このアプローチは、ここで説明されています。私はこのことができます願ってい

var map; 
 
function initMap() { 
 
    map = new google.maps.Map(document.getElementById('map'), { 
 
    center: {lat: 41.394035, lng: 2.190287}, 
 
    zoom: 17, 
 
    styles: [ 
 
     { 
 
     "featureType": "administrative.land_parcel", 
 
     "stylers": [ 
 
      { 
 
      "visibility": "off" 
 
      } 
 
     ] 
 
     }, 
 
     { 
 
     "featureType": "landscape.man_made", 
 
     "stylers": [ 
 
      { 
 
      "visibility": "off" 
 
      } 
 
     ] 
 
     }, 
 
     { 
 
     "featureType": "poi", 
 
     "stylers": [ 
 
      { 
 
      "visibility": "off" 
 
      } 
 
     ] 
 
     } 
 
    ] 
 
    }); 
 
}
#map { 
 
    height: 100%; 
 
} 
 
/* Optional: Makes the sample page fill the window. */ 
 
html, body { 
 
    height: 100%; 
 
    margin: 0; 
 
    padding: 0; 
 
}
<div id="map"></div> 
 
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDztlrk_3CnzGHo7CFvLFqE_2bUKEq1JEU&callback=initMap" 
 
    async defer></script>

https://developers.google.com/maps/documentation/javascript/styling

関心のあるポイント(場所)と建物を隠し、次の例を見てください!

関連する問題