Facility Database Files |
To obtain information about ground stations and other facilities using STK database files, use the StkFacilityDatabase class. This type uses a directory and a base filename to identify a set of files with the same name, but differing extensions, which together define the database. For more information on the format of these files, see the section on the database format below.
After instantiating an instance of StkFacilityDatabase, queries can be made to obtain a set of facilities matching a set of criteria. The following example demonstrates how to query the database for facilities:
StkFacilityDatabase db = new StkFacilityDatabase(dbDirectory, "stkFacility"); // Create a query object and then populate it with the properties to query on. // Regular expressions are used to query on strings. StkFacilityDatabaseQuery query = new StkFacilityDatabaseQuery { FacilityName = new Regex("^Diyarbak"), }; // Get the database entries matching the query and print out the Longitude and Latitude of each. foreach (StkFacilityDatabaseEntry entry in db.GetEntries(query)) { Console.WriteLine("{0}: Longitude {1}, Latitude {2}", entry.FacilityName, entry.Longitude, entry.Latitude); }
A facility database is comprised of a total of three files which have the same base filename with different file extensions. The file extension determines the type of data contained by that file. Not all files are required. If an optional data file is not present, then that information will be silently omitted from the database entries.
File | Contents | Required? |
---|---|---|
Main database file | Required | |
Facility networks | Optional | |
Generic database information | Optional |
The first file contains fixed-width fields, where one row represents a single entry. The remaining contain a standard text format.
This is the main facility database file; it contains all searchable fields. The format, starting at column zero, is as follows:
Column | Width | Description |
---|---|---|
0-36 | 37 | Site Name |
37-48 | 12 | Network (e.g., USAF) |
49-58 | 10 | Latitude (in degrees) |
59-69 | 11 | Longitude (in degrees) |
70-76 | 7 | Altitude (in meters) |
78-89 | 12 | Central Body |
This is the network file. It contains a list of all the valid facility networks and central bodies for the database, and defines the lists returned from the GetNetworks and GetCentralBodies methods.
BEGIN Network CNES CRL DLR ESA INPE ISRO NASA DSN NASDA NOAA NESDIS Other SSC USGS END Network Begin Central_Body Earth Mars Moon Sun Venus End Central_Body
This is the generic database file, which contains version information and the date of last update of the database. This information is returned from the Version and LastUpdateDate properties.
BEGIN DatabaseUpdate Version 5.0 LastUpdate 20160601 END DatabaseUpdate
In order to use facility information in other analysis in DME Component Libraries, it is useful to create a Platform object which represents the facility. To make this easy, extension methods are defined in StkFacilityDatabaseEntryExtensions and StkFacilityDatabaseExtensions that create a platform from a single database entry, or create a list of platforms for all entries matching a query, as the following example demonstrates:
foreach (StkFacilityDatabaseEntry entry in db.GetEntries(query)) { // A Platform object can be created from a single database entry. Platform platform = entry.CreatePlatform(); } // Or, a list of Platforms can be created from all entries matching a query. List<Platform> platforms = db.CreatePlatforms(query);