Click or drag to resize

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.

Facility Databases in DME Component Libraries

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:

C#
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);
}
Facility Database Format

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?

stkFacility.fd

Main database file

Required

stkFacility.fn

Facility networks

Optional

stkFacility.gd

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.

stkFacility.fd File

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

stkFacility.fn File

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.

Example stkFacility.fn file, abbreviated
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

stkFacility.gd File

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.

Example stkCityDb.gd file
BEGIN DatabaseUpdate
    Version         5.0
    LastUpdate      20160601
END DatabaseUpdate

Creating Platforms for Facilities

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:

C#
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);