AnsweredAssumed Answered

How to access coordinates from My Location result

Question asked by franklin.alexander on Feb 13, 2018
Latest reply on Feb 27, 2018 by franklin.alexander

Ok, I have to ask a very stupid question because this is frustrating me and I know it can't be that hard. I added the LocateButton to the 'NearMe' widget so anyone who needs to do a search for facilities in his/her area can search from their current gps position. Simple enough, accept that in order to tie the button to a search, I need to create a buffer around the gps position, only I can't figure out how to access the actual coordinates the My Location widgets zooms to. 


I won't post all of the code, just the snippets I added to the nearme widget for the LocateButton to work. 

_geoLocateButton: function() {
        if(this._zoomScale === null) {
            var zoomScale = parseInt(this._bufferParams.BufferDistance)*1609;
        } else {
            var zoomScale = this._zoomScale;
        console.log("zoomScale =", zoomScale);
        this._myLocation = new LocateButton({
            scale: zoomScale,
            highlightLocation: false,
            useTracking: false,
            "class": "esriCTGeoLocate"
        }, domConstruct.create("div", {}, this.myLocation));

_connectGeoLocateHandler: function () {
      //handle select location button click event
      on(dojo.query('.zoomLocateButton'), 'click', lang.hitch(this, function() {

_onGeoLocateClick: function (evt) {;
      if (this._searchInstance) {
      //the function below needs a point feature produced from an event. I may be wrong,
      // but the LocateButton doesn't seem to output a point 'feature'. It can be
      // configured to 'highlight' the zoomed to location, but is that the same thing?  
      // I guess the question is, how to I take the 'result' of LocateButton and turn it
      // into a usable point feature that can be passed to the _initWorkflow(evt) function?