var currentInfoWindow = null; function initialize() { //マップの中心点 var latlng = new google.maps.LatLng('35.16922059712234','136.8840402592773'); var myOptions = { zoom: 10, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP, scrollwheel:false }; //id値の指定 var map = new google.maps.Map(document.getElementById("map"), myOptions); var p_code = [ ['34.88041698641719','136.56354899882564','203'], ['35.00920902706579','136.51791197473258','202'], ['35.146625308186195','136.71570744018558','199'], ['35.09636720030483','136.69586184931305','196'], ['34.85069368027908','136.4509364531695','195'], ['35.008275638317514','136.65260917285838','189'], ['35.03956548459999','136.6698736368617','184'], ['34.89085715744552','136.5311086064966','180'], ['34.867130330036794','136.49114032042885','173'], ['34.884939756482396','136.5809661592331','172'], ['35.01682617237197','136.66194062348399','151'], ['34.99685061809663','136.54218393476833','140'], ['34.997182496766726','136.54112349356637','139'], ['34.97088439052685','136.62109701729014','138'], ['34.968770258228076','136.62307880217838','149'], ['34.93225308239567','136.6203459650549','150'], ['35.016295547075984','136.6616542844074','137'], ['34.880205886301724','136.5614353343933','122'], ['34.83312317741002','136.58968219786993','121'], ['34.853521102943944','136.60738389930157','114'], ['34.891758998247646','136.6269158170578','109'] ]; for(var i=0;i 0){ var lg = r_marker.getPosition().lng(); var lt = r_marker.getPosition().lat(); }else{ var minX = r_marker.getPosition().lng(); var minY = r_marker.getPosition().lat(); var maxX = r_marker.getPosition().lng(); var maxY = r_marker.getPosition().lat(); } if (lg <= minX){ minX = lg; } if (lg > maxX){ maxX = lg; } if (lt <= minY){ minY = lt; } if (lt > maxY){ maxY = lt; } } var sw = new google.maps.LatLng(maxY, minX); var ne = new google.maps.LatLng(minY, maxX); var bounds = new google.maps.LatLngBounds(sw, ne); map.fitBounds(bounds); } function createMarker(latLng,id,map){ //マーカーの位置指定 var marker = new google.maps.Marker({ position: latLng, map: map }); var infowindow = new google.maps.InfoWindow(); //吹き出し内の指定 google.maps.event.addListener(marker, "click", function() { if (currentInfoWindow) { currentInfoWindow.close(); } //吹き出し処理、情報を処理 getHukidasiData(); //ダミー画像 if(!obj_data.thumbimage_url){ obj_data.thumbimage_url = "https://shimaou.com/cms_images/none90.gif"; } var window_data = '
\
\
'+obj_data.name+'
\ \ \ \ \
賃料'+obj_data.price+'円/日
所在地'+obj_data.address+'
詳細詳細はこちら
'; infowindow.setContent(window_data); infowindow.open(map,marker); currentInfoWindow = infowindow; google.maps.event.addListener(map,'click',function(){ infowindow.close(); }); }); return marker; function getHukidasiData(){ var the_object; var http_request = new XMLHttpRequest(); http_request.onreadystatechange = getResponse; http_request.open( "GET","https://www.shimaou.com/include/map-window-data.php?category=tometarou&id="+id, false); http_request.send(null); function getResponse(){ if ( http_request.readyState == 4 ) { if ( http_request.status == 200 ) { //http_request.responseType = "json"; the_object = http_request.responseText; the_object = eval( "(" + the_object + ")" ); collback(the_object); }else { alert( "There was a problem with the URL." ); } http_request = null; } } function collback(data){ obj_data = data; } } }