WAB Directions widget shows coordinates instead of address

4563
32
Jump to solution
08-02-2017 11:33 AM
JeffPace
MVP Alum

WAB in Portal 10.5.1 is still showing coordinates instead of addresses in 10.5.1 (10.5.1 server routing service also) when using a local geocode service

It also displays mixed coordinates, web mercator sometimes, lat/long other times

The actual reversegeocode results for these two points contained a valid address.

{"address":{"Street":"611 13TH AVE E","City":"BRADENTON","ZIP":"34208","Match_addr":"611 13TH AVE E, BRADENTON, 34208"},"location":{"x":-9190285.6009550039,"y":3184609.8380619353,"spatialReference":{"wkid":102100,"latestWkid":3857}}}

The app is publicly facing
ArcGIS Web Application 

any ideas?
dlaw-esristaff
Tags (2)
32 Replies
JeffPace
MVP Alum

Derek LawKelly HutchinsDavid Coley

Confirmed with support this looks like a bug in api.

Esri Case #01970931

JS Bin - Collaborative JavaScript Debugging 

Basically if you use "geocoderOptions" with the Directions widget it works as expected.  If you use "searchOptions" in returns coordinates instead of the address when using a local geocoder.

NOTE: Prior to 3.14, this option was named 'geocoderOptions'. this has been deprecated since 3.14 so it has been broken for a long time.  It was supposedly fixed with Defect ID: BUG-000084635 but it looks like not.

Thanks all for looking into it.

DavidColey
Frequent Contributor

Good to know.  Easy enough fix to apply in the api, where would one one change this in the WAB? 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

It looks like line 162 of the Directions Widget.js (for  WAB 2.4)

            searchOptions: this.config.searchOptions,

Change to:

            geocoderOptions: this.config.searchOptions,

I have not tested this as I do not see this issue on my end.

0 Kudos
DavidColey
Frequent Contributor

Thanks Robert, I too can confirm what Jeff noted earlier for both WAB and API.

0 Kudos
JeffPace
MVP Alum

Apparently this is a false trail.  geocoderOptions worked because it is deprecated, i.e. the parameter is skipped and it is executing with no options, which means it isnt pointing to the local geocoder.

Currently the issue is you cannot use searchOptions with a local geocoder and have it return an address.

Jianxia
Esri Regular Contributor

Jeff,

Thanks for boiling down the issue. It is not a jsapi issue. We should add  searchTemplate="${Match_addr}"  to make it come up with human-friendly names for custom geocoder. This will be addressed in the next AGOL release.

 

Jianxia

DavidColey
Frequent Contributor

I'm sorry Jianxia, but this is an api issue as well.  Will the api team at 3.x provide a directions widget fix at the 3.22 release?

0 Kudos
JeffPace
MVP Alum

David, 

 No fix is needed

var sources =[
{
// locator: new Locator("https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer"),
locator: new Locator("https://www.mymanatee.org/arcgis01/rest/services/tools/AGSParcel/GeocodeServer"),
singleLineFieldName: "SingleLine",
searchTemplate:"${Match_addr}",
name: "name",
localSearchOptions: {
minScale: 300000,
distance: 50000
}
}
];

Works at 3.21

JS Bin - Collaborative JavaScript Debugging 

DavidColey
Frequent Contributor

I was missing this, thannks

searchTemplate:"${Match_addr}",

 

RobertScheitlin__GISP
MVP Emeritus

Looks like you can add line 6 to the Directions Widget.js around line 318 on my end:

          }).then(lang.hitch(this, function(geocodeMeta){
            this.config.searchOptions.sources[0].locator = new Locator(locatorUrl);
            this.config.searchOptions.sources[0].name = geocodeMeta.serviceDescription || '';
            this.config.searchOptions.sources[0].singleLineFieldName =
             geocodeMeta.singleLineAddressField && geocodeMeta.singleLineAddressField.name || '';
            this.config.searchOptions.sources[0].searchTemplate = "${Match_addr}";
            def.resolve();