Monday, February 24, 2014

Batch Compact ESRI Map Document (MXD) for 10.2


This tool is from 2012, you guys were using it frequently and asked me to compile it for 10.2 so there it goes. I have also removed the annoying lower case option, now your compacted files are saved under the same name _compact.mxd

Do you have lots of Map Documents with huge sizes?

Compact them all with one click with this tool to more than 60% of their actual size.

Download Compact MXD Tool 10.1

Download Compact MXD Tool 10.2

1) Just open an empty ArcMap session, so the tool can use it to check out license.
2) Run CompactMXD.exe
3) Select the path where your Map Documents are located.
4) Click Compact.







Download Script
Download Script



I have implemented this guy's idea .



Thursday, February 6, 2014

Easiest Method to Backup up File Geodatabases

If you are looking to backup your file geodatabase entirely, then this is the simplest approach. Create a windows batch file that copies your geodatabase to your target media, (external hard drive, flash, tape) and add it to the scheduled task at midnight.

Here is the windows batch script, copy it and paste it on a new Notepad window and save it as backupgdb.bat. Replace C:\Data\mygeodatabase.gdb path in the code with your original gdb folder, and replace E:\Backup with your target backup location.

The script will automatically append the current date so you don't have to worry about that.

 


XCOPY "C:\Data\mygeodatabase.gdb" "E:\Backup\mygeodatabase%date:/=%" /D /E /C /R /I /K /Y
pause





Now add the backupgdb.bat to the scheduled task, following are the necessary steps to do so.

  •  From the start menu, type taskschd.msc to open up the Task Scheduler
  •  Click on Create Basic Task and type in the name of the task BackupGDB, click Next.
  • Select Daily, so the task runs on a daily basis. Click Next.
  • Select the time you want this task to run, leave it at midnight and click Next
  • Select Start a Program then click Next this way we let
  • Windows start our Backupgdb.bat program.
  • Browse to your Backupgdb.bat file.
  • Click Finish and you are done.


You can create multiple batch files to backup to different locations using the same approach I guess. So you might have Backupgdb_Flash.bat, Backupgdb_NetworkDrive.bat etc..




This method might not be efficient if you want to backup a particular dataset in your geodatabase, as it will simply copy your entire geodatabase to a different location. If you have only a single dataset which is being constantly updated while rest of datasets are static, you will end up copying unchanged redundant data everyday. To copy a particular dataset only I recommend using Geodatabase Replication with a python script instead.