B4J Question Traffic Layer on jGoogle Maps

BillMeyer

Well-Known Member
Licensed User
Longtime User
Hi B4Xers

Is there a way to show the traffic layer on Google Maps in B4J ?

I've searched the forum and have not found it or have missed it somewhere.

Thanks in advance
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I'm a bit surprised to say that it is possible:



B4X:
Dim JSMap As JavaObject = gmap
Dim r As Reflector
r.Target = JSMap.GetField("map")
Dim MapJSName As String = r.GetField("variableName")
Dim javascript As JavaObject
javascript = javascript.InitializeStatic("com.lynden.gmapsfx.javascript.JavascriptRuntime").RunMethod("getInstance", Null)
Log(javascript.RunMethod("execute", Array($"
var trafficLayer = new google.maps.TrafficLayer();
trafficLayer.setMap(${MapJSName});
"$)))

https://developers.google.com/maps/documentation/javascript/examples/layer-traffic
 
Upvote 0

BillMeyer

Well-Known Member
Licensed User
Longtime User
@Erel

A very big thank you. If I ever have the privilege to meet you one day in person, this BIG South African will give you an even bigger bear hug !!

Thanks Again !!
 
Upvote 0

Tayfur

Well-Known Member
Licensed User
Longtime User

istanbul, my city...
Nice example to show the traffic intensity. I feel everday this traffic jam ...
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…