<?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 MapFrame.MapToPage(MapPoint) is not working with map rotation. in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapframe-maptopage-mappoint-is-not-working-with/m-p/1553497#M12247</link>
    <description>&lt;P&gt;The map rotation is set using the map frame camera heading before using MapFrame.MapToPoint(MapPoint).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;There is a polyline that has several vertices that I am trying to display on the page.&amp;nbsp; The map is rotated to 136 degrees, but it is displaying the point graphics as if it was 0.&amp;nbsp; They also show up outside of the map frame.&amp;nbsp; &amp;nbsp;I never get any result other than this.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is where the camera is set up:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;                        await QueuedTask.Run(() =&amp;gt;
                        {
                            try
                            {
                                Map_ = Map_Item.GetMap();
                                MapFrame_.SetMap(Map_);
                                Camera cam = MapFrame_.Camera;
                                cam.SpatialReference = Map_.SpatialReference;
                                MapPoint mp = GeometryEngine.Instance.Centroid(tile.pPolygon);

                                if (!rightToLeft)
                                    cam.Heading = tile.dRotationAngle;
                                else
                                    cam.Heading = tile.dRotationAngle - 180;


                                cam.X = mp.X;
                                cam.Y = mp.Y;
                                cam.Scale = (double)iScale;
                                Layout_ = Layout_Item.GetLayout();
                                MapFrame_.SetCamera(cam);
                                ProgressBox.WriteLine("Set camera for page " + tile.iPage);
                                ProgressBox.WriteLine("Set camera for page " + tile.iPage);
                            }
                            catch (Exception ex)
                            {
                                ProgressBox.WriteLine($"Error setting camera...Now exiting.  {ex.Message}");
                                ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show($"Error setting camera:  {ex.Message}.", "Lightning NexGen", MessageBoxButton.OK, MessageBoxImage.Error);
                                return;
                            }
                        });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is where I get the points in a loop to a location on my polyline, then use the MapToPage function:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;                            // set up Leader to Map Frame
                            if (bLeaderToMapFrame &amp;amp;&amp;amp; map is not null &amp;amp;&amp;amp; mapFrame is not null)
                            {
                                // get point at the station in the map
                                var mapPoint = GeometryEngine.Instance.QueryPoint(portion, SegmentExtensionType.NoExtension, dStationH, AsRatioOrLength.AsLength);

                                if (mapPoint is not null)
                                {
                                    var pointOnMapFrame = mapFrame.MapToPage(mapPoint);
                                    var pointSymbolmap = SymbolFactory.Instance.ConstructPointSymbol(ColorFactory.Instance.RedRGB, 4);

                                    ElementFactory.Instance.CreateGraphicElement(layout, pointOnMapFrame, pointSymbolmap);
                                }
                            }&lt;/LI-CODE&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;&lt;P&gt;Is there anything that can be done?&amp;nbsp; I have looked all over support and documentation.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Oct 2024 20:03:34 GMT</pubDate>
    <dc:creator>jeremywiles1981</dc:creator>
    <dc:date>2024-10-29T20:03:34Z</dc:date>
    <item>
      <title>MapFrame.MapToPage(MapPoint) is not working with map rotation.</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapframe-maptopage-mappoint-is-not-working-with/m-p/1553497#M12247</link>
      <description>&lt;P&gt;The map rotation is set using the map frame camera heading before using MapFrame.MapToPoint(MapPoint).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;There is a polyline that has several vertices that I am trying to display on the page.&amp;nbsp; The map is rotated to 136 degrees, but it is displaying the point graphics as if it was 0.&amp;nbsp; They also show up outside of the map frame.&amp;nbsp; &amp;nbsp;I never get any result other than this.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is where the camera is set up:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;                        await QueuedTask.Run(() =&amp;gt;
                        {
                            try
                            {
                                Map_ = Map_Item.GetMap();
                                MapFrame_.SetMap(Map_);
                                Camera cam = MapFrame_.Camera;
                                cam.SpatialReference = Map_.SpatialReference;
                                MapPoint mp = GeometryEngine.Instance.Centroid(tile.pPolygon);

                                if (!rightToLeft)
                                    cam.Heading = tile.dRotationAngle;
                                else
                                    cam.Heading = tile.dRotationAngle - 180;


                                cam.X = mp.X;
                                cam.Y = mp.Y;
                                cam.Scale = (double)iScale;
                                Layout_ = Layout_Item.GetLayout();
                                MapFrame_.SetCamera(cam);
                                ProgressBox.WriteLine("Set camera for page " + tile.iPage);
                                ProgressBox.WriteLine("Set camera for page " + tile.iPage);
                            }
                            catch (Exception ex)
                            {
                                ProgressBox.WriteLine($"Error setting camera...Now exiting.  {ex.Message}");
                                ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show($"Error setting camera:  {ex.Message}.", "Lightning NexGen", MessageBoxButton.OK, MessageBoxImage.Error);
                                return;
                            }
                        });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is where I get the points in a loop to a location on my polyline, then use the MapToPage function:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;                            // set up Leader to Map Frame
                            if (bLeaderToMapFrame &amp;amp;&amp;amp; map is not null &amp;amp;&amp;amp; mapFrame is not null)
                            {
                                // get point at the station in the map
                                var mapPoint = GeometryEngine.Instance.QueryPoint(portion, SegmentExtensionType.NoExtension, dStationH, AsRatioOrLength.AsLength);

                                if (mapPoint is not null)
                                {
                                    var pointOnMapFrame = mapFrame.MapToPage(mapPoint);
                                    var pointSymbolmap = SymbolFactory.Instance.ConstructPointSymbol(ColorFactory.Instance.RedRGB, 4);

                                    ElementFactory.Instance.CreateGraphicElement(layout, pointOnMapFrame, pointSymbolmap);
                                }
                            }&lt;/LI-CODE&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;&lt;P&gt;Is there anything that can be done?&amp;nbsp; I have looked all over support and documentation.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2024 20:03:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapframe-maptopage-mappoint-is-not-working-with/m-p/1553497#M12247</guid>
      <dc:creator>jeremywiles1981</dc:creator>
      <dc:date>2024-10-29T20:03:34Z</dc:date>
    </item>
  </channel>
</rss>

