Can I dynamically enable a geocoding endpoint?
I have added an ArcGIS Geocoding Service to a site, and this works. But what I'd like to do is enable or disable this service dynamically.
As a test I unchecked 'Include in Global Search' in the manager, and added this code to a custom module. (tried with and without 'initialize')
this.app.site.geocodingEndpoints.forEach(ep => {
ep.includeInGlobalSearch = true;
ep.initialize(null);
});
However, no request is made to the service. Am I missing something?
I tried the other way around too, (checked 'Include in Global Search' in the manager, and disabled through code), but this does not disable the search provider. It looks as if the includeInGlobalSearch property has no effect whatsoever.
0
-
Hi Berend,
It looks like it is a bit difficult to dynamically enable and disable a geocoder, due to the way the viewer initializes the Search module.
When the Search module initializes, it goes over the list of geocoding endpoints in the Site and includes any that have the includeInGlobalSearch set to true. Then, the providers are created and passed to the RegisterSearchProvider command.
This will not happen again, and there is no UnregisterSearchProvider command, so you would be able to do your code once but you would not then be able to remove the geocoder.
You may be able to locate the list of SearchProvider objects and set their isEnabled property to True or False but I am not sure how to do that. It appears to be owned by the SearchManager module.
Regards,
-Malcolm0
Please sign in to leave a comment.
Comments
1 comment