Select to view content in your preferred language

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

3005
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
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Phil,

Sorry the console command line was bad advice. It will not work there.

The route I found that involves no code is to click bookmark > then click on the feature to open the popup > then on the popup menu open the actions menu (... button) and click pan to > now create a new bookmark for that feature as the feature is now centered in the map extent.

And here is the code for opening the popup for the bookmark feature.

In the Bookmark widget folder find the CustomBookmark.js and the _onNodeBoxClick:

      _onNodeBoxClick: 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)).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);
          }
        }));
      },

View solution in original post

22 Replies
RobertScheitlin__GISP
MVP Emeritus

Phil,

   That is a little difficult. Is the point always going to be in the center of the map when that bookmark is clicked?

0 Kudos
PhilBeilin1
Regular Contributor

Robert,

I have the bookmarks set to zoom to the point. I tried as best as I could to visually have them centered on screen. Is there a way to set the center coordinates on a bookmark? 

I also have a few points close together and hope that would not interfere with this potential method.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Phil,

   And you are trying to display that particular points (pre-configured) popup right?

0 Kudos
PhilBeilin1
Regular Contributor

That would be correct. I am also using your Popup Panel custom widget.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Phil,

   That will take a bit of customization to the bookmark widget to do a query based on the extents center point and then expand that to account for the inaccuracy that it likely there in the bookmarks center to get the actual point from the FeatureClass so that can get used to set the popups setFeatures method and then show the features popup. I will see if I can find some time to help with this but no promises.

0 Kudos
PhilBeilin1
Regular Contributor

Robert,

Thanks in advance for any time you spend on this. 

In the mean-time what is the easiest way to change the center point of each bookmark so that it is exactly on the point?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Click on the bookmark and get your points coordinates from some code or ArcMap then use code like

map.extent.centerAt(new Point(your point x, your point y, map.spatialReference));

Then re-create the bookmark now that it is exact.

PhilBeilin1
Regular Contributor

Thank you!

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Phil,

   If you are able to do that then it would be less effort for me to provide the code for the bookmark widget edits.