Uploaded image for project: 'ZABBIX FEATURE REQUESTS'
  1. ZABBIX FEATURE REQUESTS
  2. ZBXNEXT-9977

geomap - add option to view current map center coordinates

XMLWordPrintable

    • Icon: New Feature Request New Feature Request
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • None
    • 7.2.5
    • Frontend (F)
    • None

      Request to add option to view current map center and zoom. This is useful when finding the right coordinates and zoom to set the "initial view" for the widget instance. We have enough users in our zabbix system that we like to set the view for them rather than relying on the user to set their own default view. 

      I am implemented this with the following customizations. Please consider implementing in the product if you feel this is warranted (there is also probably a better way to achieve this).

      I added the following right-click action which triggers a javascript alert popup with the current map center and zoom. It is formatted such that it can be copied and pasted directly into the initial view field.

      in geomap/assets/js/class.widget.js

      added this item to the const menu in the this._map.getContainer().addEventListener('contextmenu', (e)

                       

      {                         label: t('Pop-up current map center'),                         clickCallback: this.popupMapCenter.bind(this),                                              }

      then added this function on line 550 below "unsetDefaultView()"

          popupMapCenter(){
          const ll = this._map.getCenter();
          const zoom = this._map.getZoom();
          alert(`${ll.lat},${ll.lng},${zoom}`);
          }

            vmurzins Valdis Murzins
            miscoop Charles Solomon
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: