AnsweredAssumed Answered

How do I select features in a shapefile, zoom to extent and save a mxd to a directory?

Question asked by landactive on Mar 22, 2017
Latest reply on Mar 31, 2017 by iamurray

Hi - It's been 10 years since programming something .. in desperate need of assistance from this community.  I have a project that seems like an easy assignment but I forget the names of objects, calls, procedures, functions, etc. However programming theory is still ingrained into my head through years of doing it. There are 4 questions related to a project.

 

I'm not sure if ArcObjects or Python is the best way to approach it (advice here is also appreciated).

 

Context & questions below.

---

Context:

 

The project invlolves selecting a COMMUNITY name with multiple features located on a map. The data is stored in 3 separate shapefiles (points, lines & polys). For each COMMUNITY there are multiple IDs - we'll call them PINs. I want to create a series of maps (mxds) for all the PINs associated with that COMMUNITY.

 

Let's say the PIN is 8199. Since a PIN can be the form of a point, line & poly then all these features will be selected & zoomed to and appear on a map titled 8199 & saved to a directory. Then it moves onto the next PIN - 8200 and does the same thing.

 

I am aiming to do the following:

 

1) Have a button in the arcgis window that opens a msgbox (or combobox on the toolbar). The pulldown box will ask the user to select a COMMUNITY name. This will then set a COMMUNITY name for each of the 3 shapefiles.

 

Question # 1 -> How does one create a pulldown msgbox (or combobox on the toolbar) populated either from an existing feature table?  There are duplicate values for each COMMUNITY - is there a way to filter this to show only one instance (unique values) of each for the pulldown?

 

2) Select all the features for each point, line & poly layer (PIN = 8199). Maybe it is selected through a recordset,
or managed through a definition query .. I'm not sure - just looking for the easiest method.

 

Question # 2 -> What function, command or procedure is needed to do this?


3) Once all features are selected (PIN - 8199) it zooms to the extent of all the features selected.

 

Question # 3 -> What function, command or procedure is needed to zoom to all selected features?


4) Save the mxd based on 4 digit PIN selected into a directory.

 

Question # 4 -> What function, command or procedure is needed to save the mxd?

 

At this point it will move on to the next record in the recordset and do the same thing until the last record (maybe 50
or more in total maps). Ideally I would have a message box that states # of mxd's saved to the pathname
(ex: "47 maps saved to c:\gis\communitymaps")

---


I will be modifying this code and adding more bells & whistles as I go - but this is the start of it. Any help or support
from this forum is greatly appreciated.

 

Thank you.

- Bryan

Outcomes