Archives 11月 2015

APIによるGoogleMap

真ん中にマーカーが来ている

<div class=“map”>

   <script src=“https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false”></script>

    <script>

      var mapZoom = 16;

      var mapCenter = new google.maps.LatLng(39.626028,140.1615576);緯度経度

      function mapCreate(){

        var mapOption={

          zoom:mapZoom,

          center:mapCenter

        };

      var map=new google.maps.Map(document.getElementById(‘map’),mapOption);

        markerCreate(map);

      }

      function markerCreate(map){

        new google.maps.Marker({

          position:mapCenter,

          map:map

        });

      }

      google.maps.event.addDomListener(window, ‘load’, mapCreate);

    </script>

  <div id=“map”></div>

</div>

[css]これは必要

#map {
 width: 50%;
 height: 230px;
}

自作MAPをgoogleMapみたいに

 


 
<iframe class="mapillare" src="./zoom_map.html" width=100% frameborder=0></iframe>
<!DOCTYPE html>
<meta charset="utf-8">
<style>
html,body {
margin: 0;
width: 100%;
height: 100%;
overflow: hidden;
background: white;
}
.mapfr{width: 100%;
}
</style>
<body>
<script src="js/d3.v3.min.js" charset="utf-8"></script>
<script>
var zoom = d3.behavior.zoom()
.scale(1)
.scaleExtent([.1, 10])
.on("zoom", zoomed);

var svg = d3.select("body")
.call(zoom);

function zoomed() {
var t = "translate(" + d3.event.translate[0] + 'px,' + d3.event.translate[1] +"px) " +
"scale(" + d3.event.scale + ',' + d3.event.scale + ")";
d3.select("img")
.style("transform-origin", "0 0")
.style("-moz-transform-origin", "0 0")
.style("-webkit-transform-origin", "0 0")
.style("-o-transform-origin", "0 0")
.style("-ms-transform-origin", "0 0")
.style("transform", t)
.style("-moz-transform", t)
.style("-webkit-transform", t)
.style("-o-transform", t)
.style("-ms-transform", t);
}
</script>
<img class="mapfr" src="img/mapillare.svg">
</body>


 

Notice: ob_end_flush(): failed to send buffer of zlib output compression (1) in /var/www/html/wp/wp-includes/functions.php on line 5107

Notice: ob_end_flush(): failed to send buffer of zlib output compression (1) in /var/www/html/wp/wp-includes/functions.php on line 5107