Esri / Esri/workflowmanager-viewer-js

More clear documentation on adding a custom location

Open
#10 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
27
Forks
31
PR merge metrics
No merged PRs in 30d

Description

There is a section in the AppConfig.js that lets you set your own Custom locator but there is no clear documentation on how to set the `locatorSources ` array.

I thought all I would have to do is put in the URL to the locator as type `string ` and it would set up the source for me but that does not seem to be the case. I would get errors saying that `addressToLocations()` is not a function.

So after doing a little bit of digging, looking at the JS API documentation, it seems that when creating a new source you need to give it an object and then specify the new locator as a new `Locator type`. In order to get this to work, I needed to add in the Locator class in the `define ` method and then call it LocatorSources like so....

```
locatorSources: [{
locator: new Locator("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Locators/SanDiego/GeocodeServer"),
singleLineFieldName: "SingleLine",
outFields: ["*"],
name: "i18n.widgets.Search.main.esriLocatorName",
placeholder: "i18n.widgets.Search.main.placeholder"

}]
```

Only then did it work for me. I think it would be helpful if the documentation was updated to reflect this. Or if this is not supposed to work, then it may be a bug with using custom locators.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.