http://miukro.hatenablog.com/entry/2015/07/07/211358
の続き。
function initialize() { var latlng = new google.maps.LatLng(座標); var myOptions = { zoom: 18,/*拡大比率*/ scrollwheel: false, center: latlng,/*表示枠内の中心点*/ mapTypeControlOptions: { mapTypeIds: ['sample', google.maps.MapTypeId.ROADMAP] }/*表示タイプの指定*/ }; var map = new google.maps.Map(document.getElementById('map_canvas'), myOptions); /*アイコン設定▼*/ var icon = new google.maps.MarkerImage('マーカーの画像', new google.maps.Size(90,107),/*アイコンサイズ設定*/ new google.maps.Point(0,0)/*アイコン位置設定*/ ); var markerOptions = { position: latlng, map: map, icon: icon, title: '地図のタイトル' }; var marker = new google.maps.Marker(markerOptions); /*アイコン設定ここまで▲*/ /*取得スタイルの貼り付け*/ var styleOptions = [ { "stylers": [ { "weight": 0.1 }, { "saturation": -50 }, { "hue": "#00ff6f" }, { "lightness": 21 } ] } ]; var styledMapOptions = { name: '地図のタイトル' } var sampleType = new google.maps.StyledMapType(styleOptions, styledMapOptions); map.mapTypes.set('sample', sampleType); map.setMapTypeId('sample'); /*ここから2つめのマップ、1こめのソースをコピペ*/ var latlng2 = new google.maps.LatLng(座標); var myOptions2 = { zoom: 18,/*拡大比率*/ scrollwheel: false, center: latlng2,/*表示枠内の中心点*/ mapTypeControlOptions: { mapTypeIds: ['sample2', google.maps.MapTypeId.ROADMAP] }/*表示タイプの指定*/ }; var map2 = new google.maps.Map(document.getElementById('map_canvas2'), myOptions2); /*アイコン設定▼*/ var icon2 = new google.maps.MarkerImage('http://wel-seiko.sakura.ne.jp/wp/wp-content/uploads/2015/07/ico_asuka.png', new google.maps.Size(90,107),/*アイコンサイズ設定*/ new google.maps.Point(0,0)/*アイコン位置設定*/ ); var markerOptions2 = { position: latlng2, map: map2, icon: icon2, title: '地図のタイトル' }; var marker2 = new google.maps.Marker(markerOptions2); /*アイコン設定ここまで▲*/ /*取得スタイルの貼り付け*/ var styleOptions2 = [ { "stylers": [ { "weight": 0.1 }, { "saturation": -50 }, { "hue": "#ff6e00" }, { "lightness": 21 } ] } ]; var styledMapOptions2 = { name: '地図のタイトル' } var sampleType2 = new google.maps.StyledMapType(styleOptions2, styledMapOptions2); map2.mapTypes.set('sample2', sampleType2); map2.setMapTypeId('sample2'); }
とりあえず複製したソースに「2」をつけまくる。