Tag Info

New answers tagged

0

I would try this: import arcpy mxd = arcpy.mapping.MapDocument("C:\Project\Project.mxd") #I'd like to create a list for lyr in arcpy.mapping.ListLayers(mxd): if lyr.dataSource == (r"C:\Project\Data\Aerial\SID_2014"): lyr.replaceDataSource(r"C:\Data\Aerial\SID_2015", "SHAPEFILE_WORKSPACE", "SID_2015") mxd.save() At the moment you are making ...


1

As commented by @Luke, and as we were both working towards: If that is your actual code, your for lyr in arcpy.mapping.ListLayers(mxd): loop will only run on the final mxd as it is not indented to be inside the for file in mxdList: loop. Instead of your code try: import arcpy, os #workspace to search for MXDs Workspace = ...


3

This has been partially answered in: Remove username and password from saved arcgis layer (.lyr) files?, Changing workspace path of query layer using ArcPy? and Is it possible to set data source of ArcMap MXD via replica MXD on remote server?, but I want to make it exceedingly clear here. Non-Solution: You might be thinking: Ahh..Just go back into the ...


1

That works Farid Cher, but another helpful tip is to use the autoLoad property in the Config.esriaddinx: <Extensions> <Extension id="Microsoft_OnSave_Extension1" class="Extension1" productName="OnSaveExt" showInExtensionDialog="true" autoLoad="true" /> </Extensions> This may not be there by default but it is safe to add, it forces ...


5

You must write an ArcMap Addin Extension. In the extension, listen to DocumentOpened event and from there, show your form. Useful Link To create the extension, use Arcgis visual studio template. Then change SetupEvents method like this: private void SetupEvents() { m_docEvents = ArcMap.Document as IDocumentEvents_Event; ...


0

You cannot open an .mxd (ArcMap map document) file in R, so you will not be able to use the same data frame you had in ArcMap. R is statistical software; although it includes a lot of tools for data visualization, it is primarily for statistical analysis, and you are unlikely to find as many utilities for mapping and cartography as you are in ArcMap (or QGIS ...


2

As handy as R is for so many tasks, it is important to remember that 1) R is not a GIS and 2) quality mapping is downright difficult compared to creating maps with QGIS or ArcGIS. The following example borrows heavily from two R-bloggers blogs (blog 1 and blog 2). Here, I simply mapped a polygon shapefile using Google Satellite Imagery as a basemap. ...


0

mxd2qgs will work without the old module: ##import xml.dom.ext if you change: ##xml.dom.ext.PrettyPrint(doc, f) to: f.write(doc.toxml()) BUT The xml is not 'pretty', it doesn't import symbology (the script was never designed to do that), and it doesn't handle geodatabase layers. (Due credit: ...


1

But is it possible to get the current IApplication in order to set the current document? If you can't get a reference to the application object, may be you can instantiate a new AppRef object IApplication baseApp = (IApplication)Activator.CreateInstance(Type.GetTypeFromProgID("esriFramework.AppRef")); ...



Top 50 recent answers are included