Monday, September 29, 2008

Batch load a Coordinate System File to a GeoMedia GeoWorkspace document

GeoMedia's GeoWorkspace file is a document used by GeoMedia to store user preferences, legends, warehouse connections, settings, and other objects. The GeoWorkspace document has a default coordinate system assigned to it. You can change the workspace's active coordinate system interactively by using the GeoMedia application's GeoWorkspace Coordinate System dialog box (shown below) - the dialog box can be opened by selecting View > GeoWorkspace Coordinate System.

However, if you have a large number of existing GeoWorkspace documents for which you want to change the coordinate system, then doing it through the GeoMedia application's graphical user interface will be very tedious as you need to do it one by one.

So I developed a .NET console application to do the same thing but in batch mode. You simply need to create a GeoMedia coordinate system file (.csf) of your new coordinate system. Then pass in the name of the coordinate system file and the GeoWorkspace file to the console application. Example usage is shown below.



C:\> batchloadcsf -h
Batch load a coordinate system file to a GeoWorkspace file.

BATCHLOADCSF [-CSF coordinate system file] [-GWS geoworkspace file]

-CSF Specifies a coordinate system file to load.

-GWS Specifies the GeoMedia GeoWorkspace file for setting the coordinate system.



C:\> batchLoadCSF -csf CassiniSoldner.csf -gws batch1.gws
Loading csf 'C:\Temp\test\CassiniSoldner.csf' to 'C:\Temp\test\batch1.gws'
Completed



You can create a DOS batch file and loop through all your GeoWorkspace files. At the end of it, all your GeoWorkspace files will be loaded with the coordinate system from the coordinate system file.

No comments: