Versions: 9.3.1 - current
Product Availability: ArcFM Server
This developer sample converts an IMMEidSearchResults object into a KML format which may be viewed using Google Earth. To implement this sample, you will need to perform an operation that returns an IMMEidSearchResults object. This operation may call the TraceResultsToKML class in the developer sample (Miner.ConvertTraceToKML.ConvertTraceResultsToKML.TraceResultsToKML) in order to export results to KML and display them in Google Earth.
The TraceResultsToKML class has four input parameters:
- traceResults: This is the IMMEidSearchResults object that contains the search results.
- pointFeatureClassesToInclude: This is a hashtable that includes the point feature classes you wish to convert to KML.
- lineFeatureClassesToInclude: This is a hashtable that includes the linear feature classes you wish to convert to KML.
- showGoogleEarth: This is a boolean value that determines whether Google Earth is opened automatically.
How to Implement:
- Open ConvertTraceToKML.csproj and connect any broken references.
- Open SampleTraceConsole.csproj and connect any broken references.
- In ConvertTraceResultsToKML.cs, locate the following: C:\Program Files (x86)\Google\Google Earth\client\googleearth.exe
- Change this location path to match the location of your stored GoogleEarth.exe.
- In Program.cs, locate the following:
// location and name of file geodatabase
IWorkspace wksp = FileGDBWorkspace(@"D:\Program Files (x86)\Telvent\", @"MINERVILLE.gdb");
// location and name of electric network
IGeometricNetwork geometricNetwork = Network(wksp, @"ElectricDataset", @"ElecGeomNetwork");
- Change the FileGDBWorkspace location to point to your geodatabase.
Note: If you are pointing to a geodatabase other than MINERVILLE, ensure your dataset, network, and feature classes are appropriate for your geodatabase.
- Build the solution.
- When the conversion is complete, the KML files are saved to the system temp directory or build location (e.g., C:\Documents and Settings\[current user]\Local Settings\Temp). This path may be modified in the developer sample. The files saved are named: junctions.kml and edges.kml.
- In the Bin\Debug folder, run the SampleTraceConsole.exe to do the trace, perform the conversion and open those results in Google Earth.
All of the files shown below are required for the project to compile successfully.
|ConvertTraceToKML.csproj||C# project containing the code to convert trace results to KML|
|SampleTraceConsole.csproj||C# project containing the sample trace results to convert|
|ConvertTraceResultsToKML.cs||The class module to convert trace results to KML.|
|Program.cs||The sample console window class module to create trace results. Program.cs could be used to create a command line program to perform different kinds of operations and send them to Google Earth.|
|CheckOutLicenses.cs||Sample code for license checkout in standalone environments|
|LicenseInitializer.cs||Sample code for license checkout in standalong environments|