class MapLayoutHelper(object):
    """
    A helper object to initialize a project, layout, and a map for easy access.
    Usage:
        MapLayoutHelper('CURRENT')
    Constructor:
        project - (optional) The path to the ArcGIS Pro project or the text "CURRENT"
            if you are using an open proejct. The default is 'CURRENT'.
        layout - (optional) The name of the layout to initialize. The default
            is 'Template'
        map - (optional) The name of the map element inside the layout provided.
            The default is 'Map'
    """
    def __init__(self, project='CURRENT', layout='Template', map='Map'):
        from arcpy.mp import ArcGISProject
        self.project = ArcGISProject(project)
        self.layout = self.project.listLayouts(layout)[0]
        self.map = self.layout.listElements('MAPFRAME_ELEMENT', map)[0]
Ejemplo n.º 2
0
def get_layer_names(map="Map"):
    doc = ArcGISProject("current")
    m = doc.listMaps(map)[0]

    return [layer.name for layer in map.listLayers() if layer.visible and layer.isFeatureLayer]
 def __init__(self, project='CURRENT', layout='Template', map='Map'):
     from arcpy.mp import ArcGISProject
     self.project = ArcGISProject(project)
     self.layout = self.project.listLayouts(layout)[0]
     self.map = self.layout.listElements('MAPFRAME_ELEMENT', map)[0]