Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More clear documentation on adding a custom location #10

Open
nommuna2 opened this issue Feb 9, 2018 · 2 comments
Open

More clear documentation on adding a custom location #10

nommuna2 opened this issue Feb 9, 2018 · 2 comments

Comments

@nommuna2
Copy link

nommuna2 commented Feb 9, 2018

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.

@llam001
Copy link
Collaborator

llam001 commented Feb 13, 2018

Hello,

There is a link in the AppConfig.js configuration file about setting the locator sources:
https://github.com/Esri/workflowmanager-viewer-js/blob/master/js/app/WorkflowManager/config/AppConfig.js#L168

This refers to the JavaScript API doc on setting sources:
https://developers.arcgis.com/javascript/3/jsapi/search-amd.html#sources

Was there additional information that would have made it clearer?

Thanks for the feedback!

@nommuna2
Copy link
Author

nommuna2 commented Feb 13, 2018

Yes, I was following that documentation to set up the locator sources but I would get an error when I set up my locator like the example in my last comment above. The only way I got it to work is to include the Locator class in the AppConfig.js file. I needed to do this because I was defining a new Locator in the locatorSources array, otherwise it would give me a Locator is not defined error.

I might be missing something but the documentation does not say anything about including additional classes to the AppConfig.js if you need to. I assumed that the other js files would have them included already but it does not seem to be the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants