Script to automate the Swath generation

« Go Back

Information

 
QuestionHow do you automate the creation of Swaths for a satellite's sensor
Answer
A sensor swath displays the area of coverage for a vehicle sensor. This is useful for many applications, including remote sensing.  Imaging satellite providers provide Sensor Swath shapefiles to their customers to show what swaths their satellite will cover during successive days.  STK can easily create these swaths, but there are some manual steps that are required.  

To view Help on the Swath Tool, see http://help.agi.com/stk/index.htm#stk/tools-07.htm.
 

To get the swaths for a single satellite for one day (15+ passes), all start and stop times need to be added.  This can be quite manually intensive, especially if there are multiple satellites. So we will create a simple script to do this.  

The first thing we need to do is find the Connect commands to create the sensor swath. The Connect commands need to do the following:
1. Generate the swath.
2. Export it as a ShapeFile.
3. Insert back the Shape File as an Area Target.  (optional)

I have found the connect commands and implemented them into a C# application.  This is not a complete application. These commands can be used in any language that integrates with STK.
 

////SWATH FUNCTION in C#

string time = “Sept 15 2017 00:00:00”;

//This needs to be the START of your image/sensing time ENTER a

//Value to be accepted in DateTime.Parse(time) so like 'Sept 15 2017 00:00:00'

 

string Start = DateTime.Parse(time).ToString("dd MMM yyyy hh:mm:ss.000");

string Stop = DateTime.Parse(time).AddMinutes(3.0).ToString("dd MMM yyyy hh:mm:ss.000");

 

string swath_path = @"C:\agi\scenarios\ShapeFile.shp";

 

//To create a swath for the Horizon sensor:

string cmd1 = "Swath */Satellite/Satellite1/Sensor/Sensor1 \"" + Start + "\" \"" + Stop + "\"";

//To export the data for the previously created sensor swath to a shapefile

string cmd2 = "GIS * Swath \"" + swath_path + "\" */Satellite/Satellite1/Sensor/Sensor1";

//To import the shape file as a Area Target

string cmd3 = "GIS * Import \"" + swath_path + "\" AreaTarget";  //Optional
 

MessageBox.Show(cmd1);

MessageBox.Show(cmd2);

MessageBox.Show(cmd3);

root.ExecuteCommand(cmd1);

root.ExecuteCommand(cmd2);

root.ExecuteCommand(cmd3);

//////////////////////

 

 



 

TitleScript to automate the Swath generation
URL NameScript-to-automate-the-Swath-generation

Related Files