Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am creating an application where the user picks a value from a combo box, the application then selects that feature and then selects the corresponding features from a second layer, (both selections are in a different colour). What I want to do is as soon as the selection is made, the map will zoom to the envelope of the selected features. I know how to zoom to 2 individual layers (using pEnvlope.union...), but i need to do it on features.

Has anyone got any idea of the best way to do this? (I'm using ArcGIS 9.3.1 and VBA).

Thanks

share|improve this question

3 Answers 3

up vote 5 down vote accepted

You could just use the ArcMap Command, Zoom To Selected Features.

  Dim pUID As New UID
  Dim pCmdItem As ICommandItem
  ' Use the GUID of the Save command
  ' Zoom to all selected features
  pUID.Value = "{AB073B49-DE5E-11D1-AA80-00C04FA37860}"
  ' or you can use the ProgID
  ' pUID.Value = "esriArcMapUI.ZoomToSelectedCommand"
  pUID.SubType = 3
  Set pCmdItem = Application.Document.CommandBars.Find(pUID)
  pCmdItem.Execute
share|improve this answer
    
Perfect, Thanks! –  Halil Siddique Feb 22 '12 at 14:01

If you are outside of arcmap you would get the features geometries and use the IToplogicalOperator's union and zoom to the extent of the unioned geometry.

share|improve this answer

If you have info about the object, you know it's min/max X and Y's, so it's a matter of building some logic in the code tozoom to that envelope, taking into account scaling etc

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.