The
Map.addImageButton function adds a new button to the Map, using the image specified as
imagePathOrUrl as the button's icon. The
imagePathOrUrl argument is the path to a file, or a URL, containing the image the image to display on the button. Standard image files (PNG, JPEG, WebP, BMP) are supported. If using a URL, you can use a
localhost URL or a URL to a remote server. 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.