Location / Search bar in Crowdsource Reporter

260
2
07-19-2019 08:25 AM
JoCondliffe
New Contributor II

Hi,

I am hosting a public facing Crowdsource Reporter app on our own server. I would like to replace the standard Search bar which uses ArcGIS World Geocoding Service.

I would like to use my own Search bar that uses a custom geocoding service and presents the results in a more user-friendly format for people to pick a street in our district rather than searching the world.

The code for the above widget is:

var locatorURL = "{URL}/GeocodeServer";
var geocodeSearch = new Search(
	{
		sources: [{
			locator: new Locator(locatorURL),
			singleLineFieldName: "StreetNameMerged",
			outFields: ["StreetNameMerged"],
			name: "Street Names",
			placeholder: "Search for a Street Name"
		}],
		map: map,
		enableSearchingAll: false,
		autoComplete: true
	}, "geocodeSearch"				
);
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Is this possible? I've looked through the code and as a novice developer I'm baffled!

Any help would be great.

Thanks

0 Kudos
2 Replies
Noah-Sager
Esri Regular Contributor

It looks like that at around line 295 of the crowdsource-reporter-master\js\utils\utils.js file there is some logic for the Geocoder:

createGeocoderInstance: function () {
//Default geocoder url
var geocodeURL = "https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer";

...

0 Kudos
JoCondliffe
New Contributor II

Thanks for the suggestion. I've just tried that but it still only looks at the world geocode service. I've also filled in the URL in the geocode helperServices in crowdsource-reporter-master\config\defaults.js line 49 and this had no effect either.

I tried stating the URL in crowdsource-reporter-master\js\widgets\locator\locator.js line 230 where the locator is created   

locator = new Locator(geocoders.url);  

But this still didnt seem work. I'm still at a loss.

 

0 Kudos