The
Map.addImageButton function adds a new button to the Map, using the image in the
pathToImage file as the button's icon. The
pathToImage argument is the path to a file containing the image to display on the button. Standard image files (PNG, JPEG, BMP) are supported. Map buttons are displayed on the right hand-side of the map. The new button will be added below any existing buttons. When the user taps on the button, the user-defined function
callbackFunction will be called.
The
callbackFunction is the name of a user function defined in the global procedure. The function name may optionally be followed by function arguments which will be passed to the function when it is run. These arguments are evaluated at the time that
Map.addTextButton is called rather than at the time the callback is run. This allows you to reuse the same callback function for multiple buttons and to customize the behavior of the callback by passing different arguments to the callback function for each button.