Select to view content in your preferred language

Any way to open a popup of a point when a bookmark is selected?

2881
22
Jump to solution
12-18-2017 08:24 AM
PhilBeilin1
Regular Contributor

Hello and good morning GeoNet,

I currently have bookmarks for a few dozen points.

I would like to be able to select a bookmark and have it open the popup of its respected point. 

Is there any easy way to do this? Not-so-easy way to do this?

I am aware of this post here but it does not seem like the same question that I have was ever answered:  https://community.esri.com/thread/104876

Any help is greatly appreciated. Thank you.

0 Kudos
22 Replies
PhilBeilin1
Regular Contributor

nvm!

I got it to work. I was using the wrong button.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

If you use the create button in the bookmark widgets setting dialog then you have to add the code to a different file.

in the WebmapBookmarks.js replace the _onBookmarkClick function:

      _onBookmarkClick: function (bookmark) {
        require(['esri/geometry/Extent'], lang.hitch(this, function (Extent) {
          if (false !== bookmark.isSaveExtent) {
            var ext = bookmark.extent, sr;
            if (ext.spatialReference) {
              sr = new SpatialReference(ext.spatialReference);
            } else {
              sr = new SpatialReference({ wkid: 4326 });
            }
            this.map.setExtent(new Extent(ext));
            this.map.setExtent(new Extent(ext)).then(lang.hitch(this, function(){
              var currentMapCenter = this.map.extent.getCenter();
              var scrPnt = this.map.toScreen(currentMapCenter);
              this.map.emit("click", {mapPoint: currentMapCenter, screenPoint: scrPnt});
            }));
          }

          //layers
          if (true === bookmark.isSaveLayers) {
            utils.layerInfosRestoreState(bookmark.layerOptions);
          }
        }));
      },
RobertScheitlin__GISP
MVP Emeritus

Phil,

   Don't forget to re-mark this one as answered.