Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Using ArcMap 10.1, since there is not a way to control portrait or landscape of the layout view through python, is there a way to switch layout templates without opening a new mxd through python?

Since there is a change layout template button it would be nice to have a python function to do the same.

share|improve this question

You could request this as an ArcGIS Idea but so far, at least for me, requirements like this have been easy to meet by just opening a new MapDocument object so I suspect it would not attract a lot of votes.

For example, when Selecting predefined ArcMap template using ArcPy? means a "predefined template" to be an MXD located in a Map template folder inside an ArcGIS installation directory, it should just need:

mxd = arcpy.mapping.MapDocument(r"Current")

(although there is no need for the r before "Current" above)

to be replaced with:

mxd = arcpy.mapping.MapDocument(r"<path>\<template>.mxd")
share|improve this answer
    
I took "predefined template" to mean a layout template you'd typically use the "Change Layout" button on that Layout toolbar in ArcMap. Changing the MapDocument here wouldn't give the same result. – Midavalo Jan 24 at 22:34
    
@Midavalo I've not tested recently but I think it would at any version from 10.0 onwards i.e. since *.mxt files ceased to be used to define map templates. – PolyGeo Jan 24 at 22:37
    
Predefined templates now use MXD instead of MXT, however the button still exists and functions the same way "Change Layout - Change the Layout by selecting a predefined template" is the tooltip text. Using arcpy.mapping.MapDocument would just make arcpy run on a completely different MXD rather than use one MXD as a template for the CURRENT. – Midavalo Jan 24 at 22:41
    
@Midavalo There's no ArcPy method to do precisely that, and ArcPy is primarily designed for map automation with less emphasis on using it interactively within ArcMap. I think that is a pity sometimes, but I think it also means that the way I have suggested may be the asker's best option. – PolyGeo Jan 24 at 22:48

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.