Use geocoder search to locate layer features and display layer feature popup instead of geocoded result

832
1
Jump to solution
06-03-2021 02:26 PM
by Anonymous User
Not applicable

I need some assistance. I have not seen a solution to this on geonet. The threads go back on this 10 years though and ESRI still has not made this possible since the first post. I have an address point layer I would like linked to the geocoder search so the address points and address points' popups I configured in the web map display instead of the geocoded result. The closest fully functioning implementation can be found here: https://www.sagis.org/map/. It will display the parcel layer attribute popup data instead of the geocoded result by clicking the search suggestion either on the 1st or 2nd attempt. It does not display a popup when you first hit enter to search something though. It just zooms to the area. Type in "SAVANNAH COUNTRY DAY SCHOOL I" for example. @RobertScheitlin__GISP provided the code for the implementation I found on that site which was good although I do not know enough of the web appbuilder framework to get it fully working. If anyone could also let me know their thoughts on whether or not building an app with the ArcGIS API would be an easier way to do this.

0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

The code Robert provided worked all along once increasing the setTimeout. The sagis.org example possibly did not increase it although it needed to which led me to believe the code was not fully working as intended.

 

 

setTimeout(lang.hitch(this, function(){
          var mpPt;
          if(result.feature.geometry.type === "point"){mpPt = result.feature.geometry;}

          else{mpPt = result.feature.geometry.getExtent().getCenter();}
          var scrPt = this.map.toScreen(mpPt);
          this.map.emit("click", { 
            bubbles: true, 
            cancelable: true, 
            mapPoint: mpPt,
            screenPoint: scrPt
          });
        }),1200);

 

 

Is there another way other than a setTimeout to wait for the layers to load before running this function? I asked this because the function still runs before the layer has a chance to load on occasion even with the setTimeout.

View solution in original post

0 Kudos
1 Reply
by Anonymous User
Not applicable

The code Robert provided worked all along once increasing the setTimeout. The sagis.org example possibly did not increase it although it needed to which led me to believe the code was not fully working as intended.

 

 

setTimeout(lang.hitch(this, function(){
          var mpPt;
          if(result.feature.geometry.type === "point"){mpPt = result.feature.geometry;}

          else{mpPt = result.feature.geometry.getExtent().getCenter();}
          var scrPt = this.map.toScreen(mpPt);
          this.map.emit("click", { 
            bubbles: true, 
            cancelable: true, 
            mapPoint: mpPt,
            screenPoint: scrPt
          });
        }),1200);

 

 

Is there another way other than a setTimeout to wait for the layers to load before running this function? I asked this because the function still runs before the layer has a chance to load on occasion even with the setTimeout.

0 Kudos