Page 1 of 1

How can I add a Traffic Layer to a map?

Posted: Fri Apr 05, 2013 7:06 pm
by Bee Sprout

How can I add a Traffic Layer to a Map?


How can I add a Traffic Layer to a map?

Posted: Fri Apr 05, 2013 7:51 pm
by Maryna Brodina

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


How can I add a Traffic Layer to a map?

Posted: Fri Apr 05, 2013 8:55 pm
by Bee Sprout

This is how far I have gone...

var map = Tiggzi('map');

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

am I missing anything?


How can I add a Traffic Layer to a map?

Posted: Fri Apr 05, 2013 8:57 pm
by Maryna Brodina

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


How can I add a Traffic Layer to a map?

Posted: Fri Apr 05, 2013 9:03 pm
by Bee Sprout

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.


How can I add a Traffic Layer to a map?

Posted: Fri Apr 05, 2013 9:39 pm
by Maryna Brodina

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


How can I add a Traffic Layer to a map?

Posted: Sat Apr 06, 2013 4:01 am
by CarmeloMilian

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


How can I add a Traffic Layer to a map?

Posted: Mon Apr 08, 2013 7:59 am
by Maryna Brodina

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...