<?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: Zoom to Point in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/zoom-to-point/m-p/606265#M47380</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello William. Looks to me like you're trying to re-invent the wheel. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you are using ArcMap 10, check out data driven pages:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Load points feature class into a MXD&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Customize&amp;gt;Toolbars&amp;gt;Data Driven Pages&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3) Click "Data Driven Pages Setup..." button. Enable DDP and customize your settings&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If the points have an associated scale, you can enter it into the settings.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4) Go to layout view and use arrows to cycle through pages. When exporting to PDF, check out the "Pages" tab for multiple PDFs/pages.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;With DDP, you can also use the area polygons your client has instead of the center points they are providing you with. It may work better with the polygons.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you are not using ArcMap 10, I can think of two options.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Use 'MapBook'. It was the precursor to Data Driven Pages, and works similarly. &lt;/SPAN&gt;&lt;A href="http://arcscripts.esri.com/details.asp?dbid=16037" rel="nofollow noopener noreferrer" target="_blank"&gt;http://arcscripts.esri.com/details.asp?dbid=16037&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Use python. I wrote a short script that should do what you need:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy

mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0] #Change the [number] to whichever dataframe you want to use (0 is the first dataframe, 1 in the second, etc.)

for lyr in arcpy.mapping.ListLayers(mxd):
&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.name=="Points": #Change to the name of the point layer in your table of contents
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pointsLyr=lyr
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break #this will only get the first occurance of the given name in the TOC

rows = arcpy.SearchCursor(pointsLyr.dataSource)

for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByAttribute_management(pointsLyr, "NEW_SELECTION", '"FID" = '+str(row.FID))
&amp;nbsp;&amp;nbsp;&amp;nbsp; df.zoomToSelectedFeatures()
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByAttribute_management(pointsLyr, "CLEAR_SELECTION") #clears selected so that the exported PDF does not have that selected blue colouring
&amp;nbsp;&amp;nbsp;&amp;nbsp; df.scale=50000 #set scale as desired. If there is an attribute for scale use this: df.scale=row.Scale
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView()
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshTOC()
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.ExportToPDF(mxd, "C:\\Users\\jchishol\\Desktop\\TEMPzoompoint\\Output"+str(row.FID)+".pdf") #exports to PDFs. The files have the 'row.FID' in them so they do not all have the same name
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
del mxd,df,lyr,pointsLyr,row,rows
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Let me know how it goes. Good Luck!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;~Josh&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 01:58:49 GMT</pubDate>
    <dc:creator>JoshuaChisholm</dc:creator>
    <dc:date>2021-12-12T01:58:49Z</dc:date>
    <item>
      <title>Zoom to Point</title>
      <link>https://community.esri.com/t5/python-questions/zoom-to-point/m-p/606264#M47379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to figure out how to zoom to a point in arcpy.&amp;nbsp; My client would like to hand me a shape file with points in it.&amp;nbsp; Each point represents the center of an area that they want to create a PDF of.&amp;nbsp; So given a point how can I set the extent of my dataframe&amp;nbsp; and panToExtent.&amp;nbsp; The radius of each extent is no more that 500m.&amp;nbsp; So what I think will happen is I will iterate through the Points one by one. Zoom to the point set the extern to R = 500m and ExportToPDF move on to the next point.&amp;nbsp; Any help?&amp;nbsp; Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jun 2012 21:00:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/zoom-to-point/m-p/606264#M47379</guid>
      <dc:creator>WilliamIde</dc:creator>
      <dc:date>2012-06-19T21:00:16Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom to Point</title>
      <link>https://community.esri.com/t5/python-questions/zoom-to-point/m-p/606265#M47380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello William. Looks to me like you're trying to re-invent the wheel. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you are using ArcMap 10, check out data driven pages:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Load points feature class into a MXD&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Customize&amp;gt;Toolbars&amp;gt;Data Driven Pages&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3) Click "Data Driven Pages Setup..." button. Enable DDP and customize your settings&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If the points have an associated scale, you can enter it into the settings.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4) Go to layout view and use arrows to cycle through pages. When exporting to PDF, check out the "Pages" tab for multiple PDFs/pages.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;With DDP, you can also use the area polygons your client has instead of the center points they are providing you with. It may work better with the polygons.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you are not using ArcMap 10, I can think of two options.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Use 'MapBook'. It was the precursor to Data Driven Pages, and works similarly. &lt;/SPAN&gt;&lt;A href="http://arcscripts.esri.com/details.asp?dbid=16037" rel="nofollow noopener noreferrer" target="_blank"&gt;http://arcscripts.esri.com/details.asp?dbid=16037&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Use python. I wrote a short script that should do what you need:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy

mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0] #Change the [number] to whichever dataframe you want to use (0 is the first dataframe, 1 in the second, etc.)

for lyr in arcpy.mapping.ListLayers(mxd):
&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.name=="Points": #Change to the name of the point layer in your table of contents
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pointsLyr=lyr
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break #this will only get the first occurance of the given name in the TOC

rows = arcpy.SearchCursor(pointsLyr.dataSource)

for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByAttribute_management(pointsLyr, "NEW_SELECTION", '"FID" = '+str(row.FID))
&amp;nbsp;&amp;nbsp;&amp;nbsp; df.zoomToSelectedFeatures()
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByAttribute_management(pointsLyr, "CLEAR_SELECTION") #clears selected so that the exported PDF does not have that selected blue colouring
&amp;nbsp;&amp;nbsp;&amp;nbsp; df.scale=50000 #set scale as desired. If there is an attribute for scale use this: df.scale=row.Scale
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView()
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshTOC()
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.ExportToPDF(mxd, "C:\\Users\\jchishol\\Desktop\\TEMPzoompoint\\Output"+str(row.FID)+".pdf") #exports to PDFs. The files have the 'row.FID' in them so they do not all have the same name
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
del mxd,df,lyr,pointsLyr,row,rows
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Let me know how it goes. Good Luck!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;~Josh&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:58:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/zoom-to-point/m-p/606265#M47380</guid>
      <dc:creator>JoshuaChisholm</dc:creator>
      <dc:date>2021-12-12T01:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom to Point</title>
      <link>https://community.esri.com/t5/python-questions/zoom-to-point/m-p/606266#M47381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;DDP won't do it for this one I think.&amp;nbsp; Here is what I came up with.&amp;nbsp; It works.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy

mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0] #Change the [number] to whichever dataframe you want to use (0 is the first dataframe, 1 in the second, etc.)

rows = arcpy.SearchCursor(pointsLyr.dataSource)
cols = arcpy.ListFields(pointsLyr.dataSource)
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for col in cols:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if col.name == "LATITUDE":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; latstr = row.getValue(col.name)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if col.name == "LONGITUDE":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lonstr = row.getValue(col.name)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if col.name == "OBJECTID":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objstr = str(row.getValue(col.name))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByAttribute_management(pointsLyr.dataSource,"NEW_SELECTION", ("%s = %s" % (col.name, objstr)
&amp;nbsp;&amp;nbsp;&amp;nbsp; newextent = df.extent
&amp;nbsp;&amp;nbsp;&amp;nbsp; xmin = float(lonstr) - .005
&amp;nbsp;&amp;nbsp;&amp;nbsp; ymin = float(latstr) - .005
&amp;nbsp;&amp;nbsp;&amp;nbsp; xmax = float(lonstr) + .005
&amp;nbsp;&amp;nbsp;&amp;nbsp; ymax = float(latstr) + .005

&amp;nbsp;&amp;nbsp;&amp;nbsp; newextent.XMin, newextent.YMin newextent.XMax newextent.YMax = xmin, ymin, xmax, ymax
&amp;nbsp;&amp;nbsp;&amp;nbsp; df.extent = newextent
&amp;nbsp;&amp;nbsp;&amp;nbsp; df.panToExtent(df.extent)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView()&amp;nbsp; 

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It seems to work just fine.&amp;nbsp; The .005 number is basically the size.&amp;nbsp; So this could be define elsewhere and passed in as a parameter.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank for the hint.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:58:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/zoom-to-point/m-p/606266#M47381</guid>
      <dc:creator>WilliamIde</dc:creator>
      <dc:date>2021-12-12T01:58:51Z</dc:date>
    </item>
  </channel>
</rss>

