1

How do I embed a live traffic map from google?

When I click "share or embed map", it says that the map is built for me, so other users will not view the same map as me. Is there a way around this?

closed as unclear what you're asking by underdark Jan 6 '18 at 11:57

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

0

You may be able to do this with the code included on this website. They state all it requires is replacing the coordinates with your desired location.

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <title>Traffic layer</title>
    <style>
      html, body, #map-canvas {
        height: 100%;
        margin: 0px;
        padding: 0px
      }
    </style>
    <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
    <script>
function initialize() {
  var myLatlng = new google.maps.LatLng(34.04924594193164, -118.24104309082031);
  var mapOptions = {
    zoom: 13,
    center: myLatlng
  }

  var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);

  var trafficLayer = new google.maps.TrafficLayer();
  trafficLayer.setMap(map);
}

google.maps.event.addDomListener(window, 'load', initialize);

    </script>
  </head>
  <body>
    <div id="map-canvas"></div>
  </body>

</html>
  • I think there is something wrong with the javascript. It shows up an error message "Oops! Something went wrong. This page didn't load Google Maps correctly. See the JavaScript console for technical details." – Geomap Jul 20 '16 at 15:30
  • It does not have to be from google. I heard that bing has a live traffic map as well, but when I try embedding it, the traffic layer does not show. Any ideas on how to solve this? – Geomap Jul 20 '16 at 15:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.