AnsweredAssumed Answered

How to change XY Event DataSource

Question asked by LarsHolm on Sep 10, 2014
Latest reply on Mar 18, 2015 by mstead

Hi

 

Im trying to use ArcPy to make a change, that is just not a success!

 

In a mxd I have a table (table1) i a file-geodatabase - GDB1 (origin: Excel-sheet). The table contains some georeferenced data that is shown as an XY Event layer too. So I have two items addressing the same data - a standalone table (not shown in ListByDrawingOrder-mode) and a XY Event layer that has some symbology.

 

In TOC I can dbl-click them both and set a new datasource for both - individually! The problem is to do it by code (arcpy).

 

I have transfered the data to an other file-geodatabase (GDB2) and therefore I would like to change/replace the datasource for both items to the new GDB2-location.

 

I have created a script that changes the standalone table datasource to the new one (Path2\GDB2.gdb\Table2) but the corresponding XY Event still uses the old Datasource (Path1\GDB1.gdb\Table1).

The ArcPy metode used involves "for atable in arcpy.mapping.ListTableViews(mxd)" and then replacing datasource by "atable.replaceDataSource(NewGdb,"FILEGDB_WORKSPACE",NewName,True) " - but I cant find any references to the XY Event.

 

How do I change the XY Event DataSource to the new GDB and name - using ArcPy???? It is not an issue doing it manually i ArcGis/ArcCatalog, so please dont suggest this. It HAS to be done by code!

Outcomes