In an MXD file, I have a page layout and a map with a north arrow, and I need to move it in the page layout programmatically using ArcObjects Java SDK.

I managed to get the north arrow map surround object:

for(int i = 0; i < dataFrame.getMapSurroundCount(); i++) {
        IMapSurround mapSurround = dataFrame.getMapSurround(i);
        if(mapSurround instanceof INorthArrow) {
            // ...
        if(mapSurround instanceof IScaleBar) {
            log.info("scale bar");


Now, I need to get my north arrow as an IElement, in order to apply an Envelope as a geometry, that will cause the north arrow to be moved within the page layout.

INorthArrow cannot be cast to IElement (ever tried).

Any idea to get an IElement?

1 Answer 1


Cast the layout to IGraphicsContainer and call IGraphicsContainer.FindFrame, passing the map surround as its argument. The returned frame is an IElement instance.

  • Thanks, I did it but when I get an AutomationException when I set a new geometry to the IElement: Item Not Found in this Collection. in 'DAO.Fields'
    – superrache
    Mar 26, 2014 at 8:56
  • sorry, something was wrong in my Envelope creation. It works very well now, thanks a lot! I'll do the same for the scalebar.
    – superrache
    Mar 26, 2014 at 9:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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