How to display traffic information with Google MAPs API

I have recently going through the Google MAPs API and learned about displaying the traffic information of a city or a place in the Google Map.

It’s very easy to integrate . If we want to show the traffic information in our site, then this API comes in handy for us.

Before using this one in your site, you should have to get the Google API Key as this one requires a valid API key.

I want to find out the traffic information for Columbus, Ohio. Hence updated the latitude and longitude.

HTML

trafficlayercode

 

Output:

Jsfiddle page with code and output:

trafficlayer