Enhanced Locate Widget Version 2.16 - 08/21/2020

203117
233
10-02-2015 08:52 AM
Labels (1)

Enhanced Locate Widget Version 2.16 - 08/21/2020

Here is another widget for the Web App Builder.

 

Live Preview Site

Web AppBuilder for ArcGIS | Help - eLocate Widget

 

Features:

  • Locate and address (like the search widget, but gives you the ability to limit the address search to the maps current extent).
  • Locate coordinates using user defined spatial reference coordinates (i.e. DMS, State Plane, Etc).
  • Reverse Geocode capability called Address Inspection. Address Inspection is clicking on the map and getting the address of the map click point.

 

List of the latest enhancements and changes:

  1. Fixed issue with result tab being disabled and widget attempting to select the results tab.
  2. Fixed feature popups not working when the address inspector is activated and widget is closed.
  3. Add ability to specify a transform WKID.
  4. Added ability to specify the WKID that coordinates in the popup are displayed in.

 

Older Versions

Last 2.9 version

Last 2.7 version

Last 2.5 version

Last 2.4 version

Labels (1)
Attachments
Comments
RobertScheitlin__GISP
MVP Emeritus

OK, Here is a new beta 2.9 version that allows you to specify a transformation.

https://gis.calhouncounty.org/wab/V2.9/widgets/elocate/elocate.zip

LukeCooper
New Contributor

Thanks Robert, unfortunately Im getting a 404 on that link.

RobertScheitlin__GISP
MVP Emeritus

Luke,

  Sorry, link updated.

LukeCooper
New Contributor

Thanks Robert,

Great the boxes and settings come up fine. When you run Coordiante-Locate with a valid TFWKID Im getting the following error.This is only when the TFWKID is applied. 

Widget.js?wab_dv=2.9:700 Uncaught TypeError: Cannot set property 'wkid' of null
    at Object.prelocateCoords (Widget.js?wab_dv=2.9:700)
    at HTMLDivElement.<anonymous> (init.js:63)

error is highlighting in widget.js to line 700 (below line 5)

 var projParams = new ProjectParameters();
            projParams.geometries = [point];
            projParams.outSR = this.map.spatialReference;
            if(selUnit.tfwkid){
              projParams.transformation.wkid = parseInt(selUnit.tfwkid);
            }
            esriConfig.defaults.geometryService.project(projParams, lang.hitch(this, this.projectCompleteHandler2),
                                         lang.hitch(this, this.geometryService_faultHandler));

For reference when testing I've been using 27700 British National Grid and TFWKID 5339 OSGB_1936_To_WGS_1984_7. Using the esri Coordinate widget Im able to pick a location with the correct TFWKID applied. Here is an example, the red pin is 530082.352 179688.921 (with transformation set as 5339). Below is where the eLocate puts it without the TFWKID being applied.

RobertScheitlin__GISP
MVP Emeritus

Luke,

  See if this change is working for you:

            if(selUnit.tfwkid){
              projParams.transformation = {wkid: parseInt(selUnit.tfwkid)};
              projParams.transformForward = false;
            }
JohnLocke1
New Contributor III

Hello!

This widget is awesome. Is it possible, to change the coordinate system in the inspector result? I've read your comment about 102600 to 4326, but I need 23700 wkid in the result. How can I do that?

Thanks

RobertScheitlin__GISP
MVP Emeritus

John,

   Going from Web Mercator to Geographic is a simple one line of code operation. Going from Web Mercator to some other spatial reference would involve a re-project of the data using a geometry service. So currently no.

RobertScheitlin__GISP
MVP Emeritus

John,

   The 2.9 version now supports defining the WKID of the coordinates in the popup.

JohnLocke1
New Contributor III

Robert!

Thanks for your replay. I downloaded the newest version, but don't know really well, what should I do exactly to see in my 23700 wkid result when use inspector tab. Can you help me in this? 

Thanks

RobertScheitlin__GISP
MVP Emeritus

John,

   I guess you have not seen the widget help document link at the top of this page.

https://gis.calhouncounty.org/WAB/V2.9/widgets/eLocate/help/eLocate_Help.htm#GUID-E8EE57F9-E379-4EAF... 

JohnLocke1
New Contributor III

Robert,

I've read it, that was the first. But still have issues. I can't see forward or reverse, is it problem? And should I enter TFWKID here, or where the normal wkid is 4326? If here, it's not working. When to the 4326, it's still has WGS84. (SORRY for my stupid questions, I am beginner in web appbuilder, use this about in 5 weeks  )

RobertScheitlin__GISP
MVP Emeritus

John,

   You are still missing it. The help link I provided in my last reply takes you right to the spot in the help doc that explains the new WKID for coordinates displayed in popup. property on the main settings page. The TFWID does not apply to what you are wanting to do.

JohnLocke1
New Contributor III

WKID for coordinates displayed in popup ? Where?

RobertScheitlin__GISP
MVP Emeritus

John,

  That is not the newest settings dialog... Did you download the latest version from the ATTACHMENTS: eLocate.zip link above?

JohnLocke1
New Contributor III

that's one

RobertScheitlin__GISP
MVP Emeritus

Correct. Did you replace the whole eLocate folder in the stemApp widget folder AND the eLocate folder in your apps widgets folder?

JohnLocke1
New Contributor III

Yeah.

Now it's working. Restart my server machine, and it's ok now. Thanks for your work, and sorry for my questions..

RobertScheitlin__GISP
MVP Emeritus

No problem.

RyanKelso
Occasional Contributor III

Robert, we've found an issue with eLocate's address inspector and popups for other layers.  We use eLocate with the "Keep address inspector tool active after each address inspection" option enabled.  So if you use the inspect address tool, then close the eLocate widget, then try to click a feature on the map to get its popup, you get nothing.

What I see happening is when you close eLocate, it deactivates the address inspector tool as it should.  But if you open eLocate again, you see that although the address inspector tool is not active, the button for the tool still has the appearance of being active.  It seems that as long as the button appears active, popups on other layers will not work even with eLocate closed.  Deactivating the button by clicking it or switching to the Address/Coordinates tabs solves the problem.

RobertScheitlin__GISP
MVP Emeritus

Ryan,

   Issue has been fixed in 2.9.0.1 version, now available.

RyanKelso
Occasional Contributor III

Thank you Robert!  I guess a couple of people in our office have a workflow where they were running into this pretty frequently.  They will be really happy now.  Works great in WAB v2.10 by the way.

GarethYoung1
New Contributor III

Robert,

The icons on the search result and on the map aren't displaying when I deploy this widget.  Any help greatly appreciated

Thanks

Gareth

GarethYoung1
New Contributor III

I get the following in broswer dev tools:

RobertScheitlin__GISP
MVP Emeritus

Gareth,

   The symbols section of the configs\eLocate\config_X.json should look like (specifically the url property):

"symbols": {
    "coordpicturemarkersymbol": {
      "type": "esriPMS",
      "url": "images/i_pin1.png",
      "contentType": "image/png",
      "width": 20,
      "height": 20,
      "xoffset": 10,
      "yoffset": 10
    },
    "geopicturemarkersymbol": {
      "type": "esriPMS",
      "url": "images/i_house.png",
      "contentType": "image/png",
      "height": 20,
      "width": 20
    },
    "addresspicturemarkersymbol": {
      "type": "esriPMS",
      "url": "images/i_mailbox.png",
      "contentType": "image/png",
      "height": 20,
      "width": 20
    }
  },
GarethYoung1
New Contributor III

Thanks Robert.  That worked a treat.  It's difficult to find the relevent code sometimes

DanielWebb2
New Contributor III

Hi Robert,

I’m trying to use your newest Enhanced Locate Widget (version 2.9.0.1) in my ArcGIS Portal (10.5.1).  Currently it’s not loading right.

Is there any special customization I need to do in your widget in order for it to work?  Or should it work straight out of the box?

Thanks!

RobertScheitlin__GISP
MVP Emeritus

Daniel,

   Portal 10.5.1 is only using WAB 2.4 (See link below) so you can not use my latest eLocate widget. You need to get the 2.4 version from the older links above.

About release versions—Portal for ArcGIS | ArcGIS Enterprise 

DanielWebb2
New Contributor III

I wondered about that too. Thanks!  And thanks for the link.  That'll come in handy too.

KarenMotley
New Contributor II

Hi Robert,

Great widget! Does Portal for ArcGIS 10.6.1 support the eLocate version 2.7 or 2.9.0.1? I have loaded it into the environment but when attempting to load I get prompted with create widget error and the following snip-it in developer tools.

init.js:114 Error: dijit._WidgetsInTemplateMixin: parser returned unfilled promise (probably waiting for module auto-load), unsupported by _WidgetsInTemplateMixin.   Must pre-load all supporting widgets before instantiation.
    at Object._beforeFillContent (init.js:2431)
    at Object.buildRendering (init.js:383)
    at Object.g (init.js:197)
    at Object.buildRendering (init.js:378)
    at Object.create (init.js:355)
    at Object.postscript (init.js:354)
    at new <anonymous> (init.js:200)
    at Object.createWidget (main.js?wab_dv=2.8:207)
    at Object.<anonymous> (main.js?wab_dv=2.8:201)
    at init.js:63 "Error: dijit._WidgetsInTemplateMixin: parser returned unfilled promise (probably waiting for module auto-load), unsupported by _WidgetsInTemplateMixin.   Must pre-load all supporting widgets before instantiation.

RobertScheitlin__GISP
MVP Emeritus

Karen,

   10.6.1 Portal uses WAB 2.8, so the 2.7 version should work. Others have reported that there are some files missing from Portal that need to be copied over from WAB Dev. I am still not sure why WAB in Portal does not have all the files that WAB Dev does.

For anyone else that sees this comment, I had to copy ServiceBrowserRule.js and serverBrowserRuleUtils.js from "<WAB Dev Edition>\client\stemapp\jimu.js" to "C:\Program Files\ArcGIS\Portal\apps\webappbuilder\stemapp\jimu.js" and "..Portal\apps\webappviewer\jimu.js\" to get this widget to work in Portal 10.5.1.

CarlTownsend1
New Contributor III

I haven't been able to get this to work with WAB 2.11. The icon does not appear in the list of widgets. Has anyone else had this issue?

RobertScheitlin__GISP
MVP Emeritus

Carl,

   You see any errors in your browsers console?

CarlTownsend1
New Contributor III

Hi Robert,

Nothing that looks unusual to me. The widget just isn't there in the list. I've amended the json file and made sure the tool is in the widgets folder, just like I did with the other widgets I've been adding (BTW, both the ElevationProfile and eBaseMapGallery widgets work just great with WAB 2.11 - Thank you! ) here's a screenshot:

CarlTownsend1
New Contributor III

Here's a snap of my json config:

......

}, {
   "label": "Buffer",
      "uri": "widgets/Buffer/Widget"
    }, {
   "label": "selectByAttributes",
      "uri": "widgets/selectByAttributes/Widget"
    }, {
   "label": "eLocate",
      "uri": "widgets/eLocate/Widget"
    }, {
   "label": "eBasemapGallery",
      "uri": "widgets/eBasemapGallery/Widget"
    }, {
   "label": "ElevationProfile",
      "uri": "widgets/ElevationProfile/Widget"
    }, {
      "label": "Share",
      "uri": "widgets/Share/Widget"
    }]
  },

  "mobileLayout": {
    "widgetOnScreen": {
      "widgets": {

.....etc.

RobertScheitlin__GISP
MVP Emeritus

Carl,

   Strange. You know that for most widget you do Not have to manually edit the main config.json right? When you download the custom widget you just extract it and the stemapp widgets folder and then when you configure your app you will see the widget in your widget choices dialog. So [install dir]\client\stemapp\widgets\eLocate is the folder where you extracted it right. There is no sub folder under eLocate folder before you can see the manifest.json right?

CarlTownsend1
New Contributor III

I was going by instructions for installing another custom widget and it said to make an entry in the stemapp>config.json file - but good to know now! I've had issues where other widgets wouldn't work unless an entry was made to it (Or WAB is just acting oddly...I've noticed some strange things with items not being updated after a refresh...but I do several refreshes and it's there)

Anyway, success! I stopped and restarted WAB service on the server and now it is suddenly there. I refreshed and reloaded the map earlier several times and it didn't appear.

KarenMotley
New Contributor II

Unfortunately, I cannot get version 2.7 or 2.9 to work on 10.6.1 Portal. I did double check and those files were not missing from Portal.

RobertScheitlin__GISP
MVP Emeritus

Karen,

   Do you see any errors in the console?

RichBell
Occasional Contributor

How do I display both "State Plane" NAD83 and " Lat/Log"  Decimal Degrees (WGS84) in the results window?

My wkid is 102722.

"pointunits": {
    "pointunit": [
      {
        "wgs84option": "nad",
        "wkid": 102722,
        "ylabel": "Northing (Y):",
        "xlabel": "Easting (X):",
        "example": "2478127.389, 527222.779",
        "name": "NAD83, Ohio North Zone 3401"
      },
      {
        "wgs84option": "dd",
        "wkid": 4326,
        "ylabel": "Latitude:",
        "xlabel": "Longitude:",
        "example": "-80.650732489, 41.098972754",
        "name": "Decimal Degrees (WGS84)"
      },
      {

  • G
RobertScheitlin__GISP
MVP Emeritus

Rich,

   There is no option for this so a coding change is required:

      createAddressInspectorResult: function(addrCandidate) {
        var def = new Deferred();
        var result = [];
        var sAdd = this.standardizeAddress(addrCandidate);
        var locateResult = {};
        var projecting = false;
        locateResult.sym = this.rGeoMarkerSymbol;
        locateResult.title = addrCandidate.address.Address ? String(addrCandidate.address.Address) : addrCandidate.address.Street ? String(addrCandidate.address.Street) : this.manifest.name;
        var projParams = new ProjectParameters();
        if(this.map.spatialReference.wkid !== this.config.coordinateWKID){
          projParams.geometries = [addrCandidate.location];
          projParams.outSR = new SpatialReference(this.config.coordinateWKID);
          projecting = true;
          esriConfig.defaults.geometryService.project(projParams, lang.hitch(this, function(results){
            //console.info(results);
            locateResult.content = locateResult.rsltcontent = "<em>" + this.nls.address + "</em>: " +
              sAdd + "<br><em>" + this.nls.coordinates + "</em>: " +
              (results[0].x).toFixed(2) + ", " + (results[0].y).toFixed(2) +
              "<br><em>Lat, Lon</em>: " +
              (addrCandidate.location.getLatitude()).toFixed(6) + ", " + (addrCandidate.location.getLongitude()).toFixed(6);
            result.push(locateResult);
            def.resolve(result);
          }));
        }
        locateResult.content = locateResult.rsltcontent = "<em>" + this.nls.address + "</em>: " +
          sAdd + "<br><em>" + this.nls.coordinates + "</em>: " +
          (addrCandidate.location.x).toFixed(2) + ", " + (addrCandidate.location.y).toFixed(2) +
          "<br><em>Lat, Lon</em>: " +
          (addrCandidate.location.getLatitude()).toFixed(6) + ", " + (addrCandidate.location.getLongitude()).toFixed(6);
        locateResult.point = addrCandidate.location;
...
RichBell
Occasional Contributor

I make the code changes but it is giving an error.

Cannot read property 'toFixed' , Something missing...?

widget [widgets/eLocate/Widget] created.
TypeError: Cannot read property 'toFixed' of undefined
    at Object.createAddressInspectorResult (http://localhost:63342/MAHGIS_2.9/widgets/eLocate/Widget.js?wab_dv=2.9:348:52)
    at Object.rlocateResult (http://localhost:63342/MAHGIS_2.9/widgets/eLocate/Widget.js?wab_dv=2.9:276:14)
    at https://js.arcgis.com/3.25/init.js:63:337
    at Object._successHandler (https://js.arcgis.com/3.25/init.js:2243:478)
    at Object._reverseGeocodeHandler (https://js.arcgis.com/3.25/esri/tasks/locator.js:11:166)
    at https://js.arcgis.com/3.25/init.js:63:337
    at Object.load (https://js.arcgis.com/3.25/esri/tasks/locator.js:12:159)
    at https://js.arcgis.com/3.25/init.js:1047:412
    at c (https://js.arcgis.com/3.25/init.js:103:393)
    at e (https://js.arcgis.com/3.25/init.js:103:182)

RobertScheitlin__GISP
MVP Emeritus

Rich,

   I am not sure what is going wrong on your end then. I works fine for me. I even went back and made the changes in WAB 2.9 since it seems like that is the version you are using.

RichBell
Occasional Contributor

I can not find the issue.

I know this is a lot to ask but would it possible to sent the complete widget.js file and the config file. Maybe by config is causing the issue?

Thanks.

RobertScheitlin__GISP
MVP Emeritus

To verify are you using 2.9 WAB?

RichBell
Occasional Contributor

Yes, I am using 2.9

RobertScheitlin__GISP
MVP Emeritus

Here is a zip file link:

elocate.zip

RichBell
Occasional Contributor

Thank You!

Yours did not work either...

Does not work (can not find an address for a point)
  (addrCandidate.location.getLatitude()).toFixed(6) + ", " + (addrCandidate.location.getLongitude()).toFixed(6);
 
  Works to a point if I remove Fixed (6)
  but GetLatitutde is then undefined
  (addrCandidate.location.getLatitude()).toFixed(6) + ", " + (addrCandidate.location.getLongitude()).toFixed(6);
 
  I believe it can not find the values for getLatitude or getLongitude????

See image

e1

RobertScheitlin__GISP
MVP Emeritus

Rich,

  GetLatitude does not work unless the point is WKID 101200 or 4326.

Sets the longitude coordinate for this point to the specified value if the point's spatial reference is Web Mercator or Geographic (4326).

You would have to re-project the location using the GeometryService to WKID 4326.

RichBell
Occasional Contributor

I do believe you are correct. It is a WKID issue.

I can use either NAD or DD coordinates independently but not together using WKID 102722.

I'll keep plugging at it.

RobertScheitlin__GISP
MVP Emeritus

Rich, I updated my last reply. It is true you can not use GetLatitude or Long unless the Point is WKID 4326 or 102100 originally.

Version history
Last update:
‎06-09-2022 06:13 AM
Updated by: