def change_layers(self, path_mxd): arcpy.env.overwriteOutput = True conex_sde = self.gst_entorno.get_path_file_sde() mxd = self.map_document(path_mxd) for df in arcpy.mapping.ListDataFrames(mxd): mxd.activeView = df.name self.__manage_layers(mxd, df, conex_sde) del df mxd.saveACopy(r'c:\temp\sde_mxd.mxd')def __manage_layers(self, mxd, df, conex_sde): lyrs = arcpy.mapping.ListLayers(mxd, '', df) for i in range (0, len(lyrs)): i_ly = lyrs i_ly_name = i_ly.name if i_ly.isFeatureLayer: self.__change_feature(i_ly, conex_sde) del i_ly del lyrs return Truedef __change_feature(self, ly_feature, conex_sde): table_name = ly_feature.datasetName ly_feature.replaceDataSource(conex_sde, "SDE_WORKSPACE", table_name, False) return True
MapDocObject: Unable to save. Check to make sure you have write access to the specified file and that there is enough space on the storage device to hold your document.
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.