<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Adding Locators to Project with MapView.LocatorManager Resulting Two Rows in Catalog Pane in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/adding-locators-to-project-with-mapview/m-p/1563193#M12339</link>
    <description>&lt;P&gt;The following code shows our attempt to add all locators found in our Portal (Enterprise 11.3) to the active project in ArcGIS Pro (3.3.1).&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public async void AddLocators(MapView mapView, CancelableProgressorSource progress)
{
	await QueuedTask.Run(async () =&amp;gt;
	{
		var portal = ArcGISPortalManager.Current.GetActivePortal();
		PortalQueryParameters query = PortalQueryParameters.CreateForItemsOfType(PortalItemType.GeocodingService);
		LocatorManager lm = mapView.LocatorManager;
		do
		{
			PortalQueryResultSet&amp;lt;PortalItem&amp;gt; portalResults = await ArcGISPortalExtensions.SearchForContentAsync(portal, query);
			if (portalResults.Results.Count &amp;lt;= 0) break;
			progress.Max =(uint) portalResults.Results.Count;
			foreach (var item in portalResults.Results.OfType&amp;lt;PortalItem&amp;gt;())
			{
				await lm.AddLocatorAsync(item.Path);
				progress.Progressor.Value += 1;
			}
			query = portalResults.NextQueryParameters;
		} while (query != null);
	}, progress.Progressor);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code completes successfully with one issue... The results shown in the catalog pane have two rows for every locator found.&amp;nbsp;(attached file is a screenshot showing the results in catalog pane.)&lt;/P&gt;&lt;P&gt;The first row has a path ending in GeocodeServer (ex. &lt;A href="https://sipgis.lvvwd.com/arcgis/rest/services/Locators/Locator_AllFeaturesGISID/GeocodeServer)" target="_blank"&gt;https://&amp;lt;host&amp;gt;/&amp;lt;context&amp;gt;/rest/services/Locators/Locator_AllFeaturesGISID/GeocodeServer&lt;/A&gt;). This version of the locator is what I would consider more correct as its path matches what we see in Rest Service Directory. But it is not functional in ArcPro.&lt;/P&gt;&lt;P&gt;The second row has the service name repeated at the end (ex. &lt;A href="https://sipgis.lvvwd.com/arcgis/rest/services/Locators/Locator_AllFeaturesGISID/GeocodeServer)" target="_blank"&gt;https://&amp;lt;host&amp;gt;/&amp;lt;context&amp;gt;/rest/services/Locators/Locator_AllFeaturesGISID/GeocodeServer&lt;/A&gt;&lt;A href="https://sipgis.lvvwd.com/arcgis/rest/services/Locators/Locator_AllFeaturesGISID/GeocodeServer)" target="_blank"&gt;/Locator_AllFeaturesGISID&lt;/A&gt;). This locator is functional in ArcPro and matches the path of a locator the was manually added to the project using pro's Add Locator tool/command.&lt;/P&gt;&lt;P&gt;Anyone care to take a stab at what might be causing the weird results?&lt;/P&gt;</description>
    <pubDate>Thu, 28 Nov 2024 01:23:54 GMT</pubDate>
    <dc:creator>GlenColgate1</dc:creator>
    <dc:date>2024-11-28T01:23:54Z</dc:date>
    <item>
      <title>Adding Locators to Project with MapView.LocatorManager Resulting Two Rows in Catalog Pane</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/adding-locators-to-project-with-mapview/m-p/1563193#M12339</link>
      <description>&lt;P&gt;The following code shows our attempt to add all locators found in our Portal (Enterprise 11.3) to the active project in ArcGIS Pro (3.3.1).&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public async void AddLocators(MapView mapView, CancelableProgressorSource progress)
{
	await QueuedTask.Run(async () =&amp;gt;
	{
		var portal = ArcGISPortalManager.Current.GetActivePortal();
		PortalQueryParameters query = PortalQueryParameters.CreateForItemsOfType(PortalItemType.GeocodingService);
		LocatorManager lm = mapView.LocatorManager;
		do
		{
			PortalQueryResultSet&amp;lt;PortalItem&amp;gt; portalResults = await ArcGISPortalExtensions.SearchForContentAsync(portal, query);
			if (portalResults.Results.Count &amp;lt;= 0) break;
			progress.Max =(uint) portalResults.Results.Count;
			foreach (var item in portalResults.Results.OfType&amp;lt;PortalItem&amp;gt;())
			{
				await lm.AddLocatorAsync(item.Path);
				progress.Progressor.Value += 1;
			}
			query = portalResults.NextQueryParameters;
		} while (query != null);
	}, progress.Progressor);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code completes successfully with one issue... The results shown in the catalog pane have two rows for every locator found.&amp;nbsp;(attached file is a screenshot showing the results in catalog pane.)&lt;/P&gt;&lt;P&gt;The first row has a path ending in GeocodeServer (ex. &lt;A href="https://sipgis.lvvwd.com/arcgis/rest/services/Locators/Locator_AllFeaturesGISID/GeocodeServer)" target="_blank"&gt;https://&amp;lt;host&amp;gt;/&amp;lt;context&amp;gt;/rest/services/Locators/Locator_AllFeaturesGISID/GeocodeServer&lt;/A&gt;). This version of the locator is what I would consider more correct as its path matches what we see in Rest Service Directory. But it is not functional in ArcPro.&lt;/P&gt;&lt;P&gt;The second row has the service name repeated at the end (ex. &lt;A href="https://sipgis.lvvwd.com/arcgis/rest/services/Locators/Locator_AllFeaturesGISID/GeocodeServer)" target="_blank"&gt;https://&amp;lt;host&amp;gt;/&amp;lt;context&amp;gt;/rest/services/Locators/Locator_AllFeaturesGISID/GeocodeServer&lt;/A&gt;&lt;A href="https://sipgis.lvvwd.com/arcgis/rest/services/Locators/Locator_AllFeaturesGISID/GeocodeServer)" target="_blank"&gt;/Locator_AllFeaturesGISID&lt;/A&gt;). This locator is functional in ArcPro and matches the path of a locator the was manually added to the project using pro's Add Locator tool/command.&lt;/P&gt;&lt;P&gt;Anyone care to take a stab at what might be causing the weird results?&lt;/P&gt;</description>
      <pubDate>Thu, 28 Nov 2024 01:23:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/adding-locators-to-project-with-mapview/m-p/1563193#M12339</guid>
      <dc:creator>GlenColgate1</dc:creator>
      <dc:date>2024-11-28T01:23:54Z</dc:date>
    </item>
  </channel>
</rss>

