Skip to content

More clear documentation on adding a custom location  #10

@nommuna2

Description

@nommuna2

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions