B4J Question Traffic Layer on jGoogle Maps

BillMeyer

Well-Known Member
Licensed 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
 

DonManfred

Expert
Licensed User
Upvote 0

Erel

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

SS-2019-02-07_09.12.17.png


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
@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
I'm a bit surprised to say that it is possible:

SS-2019-02-07_09.12.17.png


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

:):):):) istanbul, my city...
Nice example to show the traffic intensity. I feel everday this traffic jam ...
 
Upvote 0
Top