<?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: How to convert screen pixels to map units in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-convert-screen-pixels-to-map-units/m-p/1148192#M7847</link>
    <description>&lt;P&gt;Gintautas,&lt;/P&gt;&lt;P&gt;Thanks for the link.&amp;nbsp; I looked it over and I did find some interesting information concerning LinearUnits, but I didn't find an answer to my question regarding the conversion of screen coordinates in pixels to map units.&lt;/P&gt;</description>
    <pubDate>Fri, 25 Feb 2022 21:42:37 GMT</pubDate>
    <dc:creator>DaveLewis73</dc:creator>
    <dc:date>2022-02-25T21:42:37Z</dc:date>
    <item>
      <title>How to convert screen pixels to map units</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-convert-screen-pixels-to-map-units/m-p/1147667#M7840</link>
      <description>&lt;P&gt;I am looking to create polygons (halos/rings) around the mouse cursor.&amp;nbsp; I have figured out how to create the halos by using &lt;STRONG&gt;System.Windows.Forms.Control.MousePosition&lt;/STRONG&gt; and then converting into lat/long by using&amp;nbsp;&lt;STRONG&gt;MapView.Active.ScreenToMap&lt;/STRONG&gt;.&amp;nbsp; I have also used a MouseHook from the Win32Api to give me a MouseMove event.&amp;nbsp; This allows me to associate the polygon to the mouse cursor and move it around the map as an overlay.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem that I am having now is that I can only create a polygon (halo/ring) with a radius in pixels.&amp;nbsp; I need to be able to use map units, like feet, meters, miles, kilometers, etc.&amp;nbsp; For example, I want to create a polygon (halo/ring) that has a radius of 100 feet.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there some way to accomplish this?&lt;/P&gt;&lt;P&gt;The following is a method that I am using that takes pixels to create the halo, just in case it would be of help to someone:&lt;/P&gt;&lt;P&gt;private ArcGIS.Core.Geometry.Polygon CreateHaloPolygon(MapPoint mapPoint, int pixels, out double radius)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; // Get the halo radius&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Point screenPoint = MapView.Active.MapToScreen(mapPoint);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Point radiusScreenPoint = new Point((screenPoint.X + pixels), screenPoint.Y);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; MapPoint radiusMapPoint = MapView.Active.ScreenToMap(radiusScreenPoint);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; radius = GeometryEngine.Instance.Distance(mapPoint, radiusMapPoint);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; // Build a circle geometry&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Coordinate2D coord2D = new Coordinate2D(mapPoint);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; EllipticArcSegment arcSegment = EllipticArcBuilder.CreateEllipticArcSegment(coord2D, radius,&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; esriArcOrientation.esriArcClockwise, SpatialReferences.WGS84); //MapView.Active.Map.SpatialReference);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; PolygonBuilder polyBuilder = new PolygonBuilder(new[] { arcSegment });&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; return polyBuilder.ToGeometry();&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Mon, 28 Feb 2022 20:56:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-convert-screen-pixels-to-map-units/m-p/1147667#M7840</guid>
      <dc:creator>DaveLewis73</dc:creator>
      <dc:date>2022-02-28T20:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert screen pixels to map units</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-convert-screen-pixels-to-map-units/m-p/1147705#M7841</link>
      <description>&lt;P&gt;Does the snippet &lt;A href="https://github.com/Esri/arcgis-pro-sdk/wiki/ProSnippets-MapExploration#calculate-selection-tolerance-in-map-units" target="_self"&gt;Calculate Selection tolerance in map units&lt;/A&gt; help at all in converting from screen pixel to map units?&lt;/P&gt;</description>
      <pubDate>Thu, 24 Feb 2022 20:25:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-convert-screen-pixels-to-map-units/m-p/1147705#M7841</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2022-02-24T20:25:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert screen pixels to map units</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-convert-screen-pixels-to-map-units/m-p/1147706#M7842</link>
      <description>&lt;P&gt;Ken,&lt;/P&gt;&lt;P&gt;Thank you for your reply.&amp;nbsp; Unfortunately, I have already come across that sample and it doesn't work for me.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Feb 2022 20:27:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-convert-screen-pixels-to-map-units/m-p/1147706#M7842</guid>
      <dc:creator>DaveLewis73</dc:creator>
      <dc:date>2022-02-24T20:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert screen pixels to map units</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-convert-screen-pixels-to-map-units/m-p/1147860#M7846</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Have tried&amp;nbsp;EllipticArcBuilder ?&lt;/P&gt;&lt;P&gt;More info here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Esri/arcgis-pro-sdk/blob/master/Examples/Geometry/ProSnippets.cs" target="_self"&gt;https://github.com/Esri/arcgis-pro-sdk/blob/master/Examples/Geometry/ProSnippets.cs&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Feb 2022 06:35:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-convert-screen-pixels-to-map-units/m-p/1147860#M7846</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2022-02-25T06:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert screen pixels to map units</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-convert-screen-pixels-to-map-units/m-p/1148192#M7847</link>
      <description>&lt;P&gt;Gintautas,&lt;/P&gt;&lt;P&gt;Thanks for the link.&amp;nbsp; I looked it over and I did find some interesting information concerning LinearUnits, but I didn't find an answer to my question regarding the conversion of screen coordinates in pixels to map units.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Feb 2022 21:42:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-convert-screen-pixels-to-map-units/m-p/1148192#M7847</guid>
      <dc:creator>DaveLewis73</dc:creator>
      <dc:date>2022-02-25T21:42:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert screen pixels to map units</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-convert-screen-pixels-to-map-units/m-p/1153873#M7940</link>
      <description>&lt;P&gt;I have solved this issue by using the&amp;nbsp;&lt;STRONG&gt;GeometryEngine.Instance.GeodesicEllipse&lt;/STRONG&gt; method.&amp;nbsp; It takes in a GeodesicEllipseParamter containing all of the necessary parameters to create the ellipse and a spatial reference.&amp;nbsp; Included in the parameters is the radius and the linear units to use.&amp;nbsp; The following is a code snippet of creating the geodesic ellipse:&lt;/P&gt;&lt;P&gt;private ArcGIS.Core.Geometry.Geometry BuildBufferEllipse(MapPoint mapPt, double radius, string linearUnits)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; var ellipseParams = new GeodesicEllipseParameter&lt;BR /&gt;&amp;nbsp; &amp;nbsp; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Center = new Coordinate2D(mapPt),&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AxisDirection = 0.0,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; LinearUnit = GetLinearUnits(linearUnits),&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; OutGeometryType = GeometryType.Polygon,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SemiAxis1Length = radius,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SemiAxis2Length = radius,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; VertexCount = 99&lt;BR /&gt;&amp;nbsp; &amp;nbsp; };&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; return GeometryEngine.Instance.GeodesicEllipse(ellipseParams, MapView.Active.Map.SpatialReference);&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2022 16:15:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-convert-screen-pixels-to-map-units/m-p/1153873#M7940</guid>
      <dc:creator>DaveLewis73</dc:creator>
      <dc:date>2022-03-15T16:15:52Z</dc:date>
    </item>
  </channel>
</rss>

