How to create a Python Toolbox or ModelBuilder in ArcGIS Pro used for finding latitude, longitude in basemap And when the search is complete, zoom in at 500 meters.
You could try something like the following. The script is inspired by this question.
Please note I did not get the scale property to work, so you could try specifying your own scale.
import arcpy
currentProject = arcpy.mp.ArcGISProject('current')
activeObject = currentProject.activeView
x = float(arcpy.GetParameterAsText(0))
y = float(arcpy.GetParameterAsText(1))
yourScale = float(arcpy.GetParameterAsText(2))
xMin = x-yourScale
yMin = y-yourScale
xMax = x+yourScale
yMax = y+yourScale
extent = arcpy.Extent(xMin,yMin,xMax,yMax)
activeObject.camera.setExtent(extent)
Some notes:
- This script assumes you are working in the map you wish to change the view in.
- You can enter the coordinates by hand (hence the GetParameterAsText for x and y) and it assumes you already know the coordinates you are looking for (for example from an Excel file).
- The scale is used to create a square of sorts to set the extent. You may have to alter this to suit your needs.
- The scale is now published as parameter. You could hardcode this or provide a default value.
If this is not really what you are looking for, could you please elaborate what the script should do?