amaptor.Layout

class amaptor.Layout(layout_object, project)[source]

Replicates Layouts so that we can do some nice things behind the scenes.

In ArcMap, a single layout is created - that way, a layout can safely be retrieved for all documents and modifying properties of a layout modifies corresponding map document properties.

export_to_pdf(out_path, **kwargs)[source]
export_to_png(out_path, resolution=300)[source]
Currently Pro only - needs refactoring to support ArcMap and Pro (should export map document in ArcMap). Also needs refactoring to combine Map and Layout export code.
Parameters:
  • out_path
  • resolution
Returns:

find_element(name)[source]
Finds the first element matching the provided name
Parameters:name
Returns:
find_map_frame(name)[source]
Finds the map frame with a given name
Parameters:name – the name of the frame to find
Returns:MapFrame object
list_elements()[source]
name
Corresponds to the name of a layout in Pro and the Map Document’s “title” property in ArcMap
Returns:
replace_text(text, replacement)[source]
Single layout analogue of Project.replace_text. Given a string and a replacement value, replaces all instances of that string in all text elements in the layout. Useful for having template strings in a map document
Parameters:
  • text
  • replacement
Returns:

toggle_element(name_or_element, visibility='TOGGLE')[source]
Given an element name, toggles, makes visible, or makes invisible that element.
Parameters:
  • name_or_element – a string name of an element, or an element object
  • visibility – Controls the action. Valid values are boolean (True, False) or the keyword “TOGGLE” which switches its current visibility state.
Returns: