<?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 Re: Getting coordinates using button accessed via right-click context menu in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-coordinates-using-button-accessed-via/m-p/1392313#M11202</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Here's an old editing sample that uses the right-click coordinate to find a feature.&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Editing/ReplaceSketch" target="_self"&gt;https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Editing/ReplaceSketch&lt;/A&gt;&lt;BR /&gt;(take a look in ReplaceSketch.cs)&lt;/P&gt;&lt;P&gt;The command is added to the sketch context menu via config.daml.&lt;/P&gt;</description>
    <pubDate>Thu, 07 Mar 2024 01:40:09 GMT</pubDate>
    <dc:creator>sjones_esriau</dc:creator>
    <dc:date>2024-03-07T01:40:09Z</dc:date>
    <item>
      <title>Getting coordinates using button accessed via right-click context menu</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-coordinates-using-button-accessed-via/m-p/1392223#M11201</link>
      <description>&lt;P&gt;I want a button that is accessed when you right-click on the map with the explorer or selection tool.&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;This needs to get the coordinates of where on the map was right-clicked.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Currently, I can only get the coordinates from the centre of the map view like this:&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;protected override void OnClick()&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;// Get the current map view&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;var mapView = MapView.Active;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#999999"&gt;if (mapView == null)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;Console.WriteLine("No active map view found.");&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;return;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#999999"&gt;// Get the extent of the map view&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;var extent = mapView.Extent;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#999999"&gt;// Get the center of the extent (which represents the point where the context menu was opened)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;var mapPoint = extent.Center;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#999999"&gt;// Print the map coordinates&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;Console.WriteLine($"Map Coordinates: X={mapPoint.X}, Y={mapPoint.Y}");&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;I know you can get the coordinates using a map tool by clicking on the map. But it seems you cannot add map tool to the context menu of selection/explorer tool, unless I am mistaken. i acheived a work around by creating a button that opens the map tool.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;However, I would prefer a method to get the coordinates using the button so that the user does not need to click on the map again.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Is there any inbuilt method to do this in SDK?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 01:13:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-coordinates-using-button-accessed-via/m-p/1392223#M11201</guid>
      <dc:creator>JMagson</dc:creator>
      <dc:date>2024-03-07T01:13:01Z</dc:date>
    </item>
    <item>
      <title>Re: Getting coordinates using button accessed via right-click context menu</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-coordinates-using-button-accessed-via/m-p/1392313#M11202</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Here's an old editing sample that uses the right-click coordinate to find a feature.&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Editing/ReplaceSketch" target="_self"&gt;https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Editing/ReplaceSketch&lt;/A&gt;&lt;BR /&gt;(take a look in ReplaceSketch.cs)&lt;/P&gt;&lt;P&gt;The command is added to the sketch context menu via config.daml.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 01:40:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/getting-coordinates-using-button-accessed-via/m-p/1392313#M11202</guid>
      <dc:creator>sjones_esriau</dc:creator>
      <dc:date>2024-03-07T01:40:09Z</dc:date>
    </item>
  </channel>
</rss>

