<?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 ArcGIS Pro 2.5 - Python - MapView exportToPNG not correctly? in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-2-5-python-mapview-exporttopng-not/m-p/542895#M23845</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to export PNG's at a set scale based on the center point of a points file I have.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I run my code I can see the map co-ordinates being panned around to each one along with the corresponding print command in the Python terminal - however, when it gets to the mv.exportToPng function - it prints black squares...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can't for the life of me work out why if &lt;STRONG&gt;mv.panToExtent(thing[0].extent)&lt;/STRONG&gt; moves my active map to the correct position why &lt;STRONG&gt;mv.exportToPng(...)&amp;nbsp;&lt;/STRONG&gt;won't print properly...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would have used MapSeries if only the exportToPNG option would allow the writing of world files...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway below is my code:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;import arcpy, time&lt;BR /&gt;aprx = arcpy.mp.ArcGISProject('current')&lt;BR /&gt;mv = aprx.activeView&lt;BR /&gt;fc = r'D:\Image Detection\Image Detection ArcPro\Image Detection_Sentinel\Image Detection_Sentinel.gdb\Training_Data_Oman_Reliable_2015_Onwards'&lt;BR /&gt;count = 1&lt;BR /&gt;with arcpy.da.SearchCursor(fc, ['SHAPE@']) as cursor:&lt;BR /&gt; for thing in cursor:&lt;BR /&gt; mv.panToExtent(thing[0].extent)&lt;BR /&gt; print(thing[0].extent)&lt;BR /&gt; time.sleep(1)&lt;BR /&gt; mv.exportToPNG(os.path.join(r"D:\Image Detection\Image Detection ArcPro\Image Detection_Sentinel", "Output", f"Image_{count}.png"), width=4000, height=4000, resolution=300,world_file=True, color_mode="8-BIT_GRAYSCALE")&lt;BR /&gt; count += 1&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;BR /&gt;Anyone got any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Luke&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 19 Feb 2020 14:29:01 GMT</pubDate>
    <dc:creator>LukeCalladine</dc:creator>
    <dc:date>2020-02-19T14:29:01Z</dc:date>
    <item>
      <title>ArcGIS Pro 2.5 - Python - MapView exportToPNG not correctly?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-2-5-python-mapview-exporttopng-not/m-p/542895#M23845</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to export PNG's at a set scale based on the center point of a points file I have.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I run my code I can see the map co-ordinates being panned around to each one along with the corresponding print command in the Python terminal - however, when it gets to the mv.exportToPng function - it prints black squares...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can't for the life of me work out why if &lt;STRONG&gt;mv.panToExtent(thing[0].extent)&lt;/STRONG&gt; moves my active map to the correct position why &lt;STRONG&gt;mv.exportToPng(...)&amp;nbsp;&lt;/STRONG&gt;won't print properly...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would have used MapSeries if only the exportToPNG option would allow the writing of world files...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway below is my code:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;import arcpy, time&lt;BR /&gt;aprx = arcpy.mp.ArcGISProject('current')&lt;BR /&gt;mv = aprx.activeView&lt;BR /&gt;fc = r'D:\Image Detection\Image Detection ArcPro\Image Detection_Sentinel\Image Detection_Sentinel.gdb\Training_Data_Oman_Reliable_2015_Onwards'&lt;BR /&gt;count = 1&lt;BR /&gt;with arcpy.da.SearchCursor(fc, ['SHAPE@']) as cursor:&lt;BR /&gt; for thing in cursor:&lt;BR /&gt; mv.panToExtent(thing[0].extent)&lt;BR /&gt; print(thing[0].extent)&lt;BR /&gt; time.sleep(1)&lt;BR /&gt; mv.exportToPNG(os.path.join(r"D:\Image Detection\Image Detection ArcPro\Image Detection_Sentinel", "Output", f"Image_{count}.png"), width=4000, height=4000, resolution=300,world_file=True, color_mode="8-BIT_GRAYSCALE")&lt;BR /&gt; count += 1&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;BR /&gt;Anyone got any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Luke&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Feb 2020 14:29:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-2-5-python-mapview-exporttopng-not/m-p/542895#M23845</guid>
      <dc:creator>LukeCalladine</dc:creator>
      <dc:date>2020-02-19T14:29:01Z</dc:date>
    </item>
  </channel>
</rss>

