How to work with Google Maps API in atvise

Created by Vester Business Support Team, Modified on Wed, 25 Nov, 2020 at 9:45 PM by Vester Business Support Team


To dynamize the map you can basically use everything that the Google MAP API provides (https://developers.google.com/maps/documentation/javascript/overview) and use the webMI.data methods (atvise help -> Clientside Scripting -> Data functions).

For example to add a marker to some coordinates you can use:
   

 
var position1 = new google.maps.LatLng(47.85193,16.54015);
 
marker1 = new google.maps.Marker({
    position: position1,
    map: map,
    title: "Building 1",
});


Then for example to open a popUp in atvise when the marker is clicked:
   

 
marker1.addListener("click", function(e){
    webMI.display.openWindow...
});


Or to change the marker symbol based on some data values:
   

 
webMI.data.subscribe("AGENT.OBJECTS.Building_1.LightOn", function(e) {
    if(e.value) {
        marker1.setIcon(symbolLightOn);
    } else {
        marker2.setIcon(symbolLightOff);
    }
});


Attached you find an extended example database with two markers with some mouse events and symbol change based on data values. The corresponding implementation can be found in the script code of the "MAIN.Google Maps" display.
 

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article