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 trying to build an add-in that will create a polygon from the current map extent. This is not a problem in Data View where I can easily get the envelope of an iMxDocument:iActiveView in data view. I need to do the same in Layout view, preferably without switching back and forth between layout and data views.

When in Layout the iActiveView:Extent:Envelope returns an envelope coordinates of the map position with respect to the layout. (position of the map frame on paper so to speak) How do I transform these into actual map coordinates? I tried using iDisplayTransoformation:ToMapPoint but the input needs to be a screen point and the coordinates I have are of the map frame with respect to layout, not screen coordinates.

In other words i need to transform page units to map units whereas iDisplayTransformation will transform only screen nits to map units or screen units to page units.

Thanks

share|improve this question
    
Possible info here: forums.esri.com/… –  mkennedy Oct 3 '12 at 22:29
add comment

1 Answer 1

Found it: iDisplayTrasformation:TransformRect

VB example here

share|improve this answer
    
I wonder if that code does when the map is rotated slightly (IDisplaytransformation.Rotation != 0). To handle that case, it seems like you'd need to use four corner points instead of a rectangle. TransformPointsFI to get from page to device units, then TransformPointsIF to go from device to map. –  Kirk Kuykendall Jul 6 '12 at 1:47
    
Thanks @Kirk. That sounds like a better approach. I am running into some issues with the linked sample. –  Jakub Jul 6 '12 at 4:02
    
@KirkKuykendall - would you be able to add a code snippet or a link to one as a separate answer? The code in the link I posted gets me an envelope of the data frame when in layout but not the extent of the layout map frame. I will add some visual to illustrate what I am after... –  Jakub Jul 6 '12 at 13:36
add comment

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.