<?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 Map automation - specific to my organisation in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/map-automation-specific-to-my-organisation/m-p/1185015#M56414</link>
    <description>&lt;P&gt;Hi All!&lt;/P&gt;&lt;P&gt;I'm currently working on a script that can automate basic map production for my organisation.&lt;/P&gt;&lt;P&gt;The current part I'm stuck on is, I have bookmarks that the user can select from a pre-defined list, although if the area they want to look at isn't in that list they could enter the extent themselves and set the scale. Although, currently if they select a bookmark and leave the extent part blank it throws an error as nothing has been entered for extent even though I have set it to be an optional parameter.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way I can calculate the extent if the user selects a bookmark so they can be in the same tool, while allowing the user to manually enter the extent if needed?&lt;/P&gt;&lt;P&gt;Below is my current code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
arcpy.env.overwriteOutput = True
workspace = arcpy.GetParameterAsText(0)
aprx = arcpy.mp.ArcGISProject('CURRENT')
lyt = aprx.listLayouts(Product_Size)[0]
aprxMap = aprx.listMaps('Map')[0]
mf = lyt.listElements('MAPFRAME_ELEMENT', 'Map Frame')[0]
in_bookmark = arcpy.GetParameterAsText(1)
bookmark = mf.map.listBookmarks()
# Loop to zoom if user selects bookmark
for bkmk in bookmark:
    if bkmk.name == in_bookmark:
        mf.zoomToBookmark(bkmk) 
        arcpy.AddMessage(f'{in_bookmark} bookmark set')        
    else:
        continue
extent = arcpy.GetParameterAsText(2)
arcpy.env.extent = extent
mf.camera.setExtent(arcpy.env.extent)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think my issue is I'm still not understanding how exactly extent works in arcpy, but reading the documentation hasn't been much help so far. I would really appreciate some help or a nice gentle nudge in the right direction. If more of the overall code would be useful to see, let me know!&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jun 2022 11:46:37 GMT</pubDate>
    <dc:creator>MichaelFowler1</dc:creator>
    <dc:date>2022-06-22T11:46:37Z</dc:date>
    <item>
      <title>Map automation - specific to my organisation</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/map-automation-specific-to-my-organisation/m-p/1185015#M56414</link>
      <description>&lt;P&gt;Hi All!&lt;/P&gt;&lt;P&gt;I'm currently working on a script that can automate basic map production for my organisation.&lt;/P&gt;&lt;P&gt;The current part I'm stuck on is, I have bookmarks that the user can select from a pre-defined list, although if the area they want to look at isn't in that list they could enter the extent themselves and set the scale. Although, currently if they select a bookmark and leave the extent part blank it throws an error as nothing has been entered for extent even though I have set it to be an optional parameter.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way I can calculate the extent if the user selects a bookmark so they can be in the same tool, while allowing the user to manually enter the extent if needed?&lt;/P&gt;&lt;P&gt;Below is my current code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
arcpy.env.overwriteOutput = True
workspace = arcpy.GetParameterAsText(0)
aprx = arcpy.mp.ArcGISProject('CURRENT')
lyt = aprx.listLayouts(Product_Size)[0]
aprxMap = aprx.listMaps('Map')[0]
mf = lyt.listElements('MAPFRAME_ELEMENT', 'Map Frame')[0]
in_bookmark = arcpy.GetParameterAsText(1)
bookmark = mf.map.listBookmarks()
# Loop to zoom if user selects bookmark
for bkmk in bookmark:
    if bkmk.name == in_bookmark:
        mf.zoomToBookmark(bkmk) 
        arcpy.AddMessage(f'{in_bookmark} bookmark set')        
    else:
        continue
extent = arcpy.GetParameterAsText(2)
arcpy.env.extent = extent
mf.camera.setExtent(arcpy.env.extent)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think my issue is I'm still not understanding how exactly extent works in arcpy, but reading the documentation hasn't been much help so far. I would really appreciate some help or a nice gentle nudge in the right direction. If more of the overall code would be useful to see, let me know!&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2022 11:46:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/map-automation-specific-to-my-organisation/m-p/1185015#M56414</guid>
      <dc:creator>MichaelFowler1</dc:creator>
      <dc:date>2022-06-22T11:46:37Z</dc:date>
    </item>
  </channel>
</rss>

