Use python to zoom on opening

07-28-2017 12:13 PM
New Contributor

how can i use python to ..upon opening a map,center (pan/zoom) to an event ( a point drawn by a X Y Coord. in a table kept in the map) and set the extent of that in data view to 1:10000?

Tags (1)
0 Kudos
2 Replies
MVP Legendary Contributor

If everything is already in the project at the desired location and scale... save it as a bookmark... then save the project.

When the project opens, everything will be as you left it.

However, I suspect that what you really want is a script that takes user input for some point coordinate, then zooms to that location and scale... that is a separate beast.

Occasional Contributor III

You could try an application extension, which as I understand it will listen for events like opening an MXD and then execute some logic, which could include what you mentioned.

Creating a Python add-in application extension—Help | ArcGIS for Desktop 

To zoom to your feature, select it using Select By Attribute and then use the zoomToSelectedFeatures method of the data frame object.

DataFrame—Help | ArcGIS for Desktop 

Good luck.