Bee Sprout
Posts: 0
Joined: Wed Apr 03, 2013 6:44 pm

How can I add a Traffic Layer to a map?

How can I add a Traffic Layer to a Map?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

How can I add a Traffic Layer to a map?

Hello! You would need to check Google API docs https://developers.google.com/maps/do...

Bee Sprout
Posts: 0
Joined: Wed Apr 03, 2013 6:44 pm

How can I add a Traffic Layer to a map?

This is how far I have gone...

var map = Tiggzi('map');

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

am I missing anything?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

How can I add a Traffic Layer to a map?

Sorry, I need more details. Do you have any specific problem?

Bee Sprout
Posts: 0
Joined: Wed Apr 03, 2013 6:44 pm

How can I add a Traffic Layer to a map?

sorry, I am getting the map.

This works fine in getting me the map and current location.

var map = Tiggzi('map');
map.options['address']='';
map.refresh();

after trying to understand the layers adding link from google api, in order to add the traffic layer I did this.

var map = Tiggzi('map');
var trafficLayer = new google.maps.TrafficLayer();
trafficLayer.setMap(map);
map.refresh();

With this change I lost current location and still not getting the traffic layer. I am wondering if my syntax is way off.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

How can I add a Traffic Layer to a map?

Instead of
codevar map = Tiggzi('map');
var trafficLayer = new google.maps.TrafficLayer();
trafficLayer.setMap(map);
map.refresh();/code

try this code:
codevar myLatLng = new google.maps.LatLng(34.04924594193164, -118.24104309082031);
var mapOptions = {
zoom: 13,
center: myLatLng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(Tiggzi("mapName").get(0), mapOptions);
var trafficLayer = new google.maps.TrafficLayer();
trafficLayer.setMap(map);/code
where mapName - GoogleMap component name

CarmeloMilian
Posts: 0
Joined: Sat Apr 06, 2013 4:01 am

How can I add a Traffic Layer to a map?

it didn't work, should i use a div, instead of the google map control?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

How can I add a Traffic Layer to a map?

Hello! You can use either map or Panel with div type. The problem is probably that code loads before map. You would need to track map loading and add the code after map load.

To use Panel with div type, but as you would need to delete map component, to get it working add in App settings - External resources next link
http://maps.google.com/maps/api/js?se...

Return to “Issues”