Using the Shape Layer

From JMARS Wiki

Jump to: navigation, search

The purpose of this tutorial is to walk users through the process of opening JMARS, navigating to the MER-A (Spirit) landing site at Gusev Crater, opening the Shape Layer, creating Features (points, polylines and polygons), editing the parameters of the Features and modifying the Features using Shape Layer scripts.


  1. Opening JMARS, Navigating to Gusev Crater and Opening the Shape Layer
  1. Open a terminal window and type: "jmars clean 0 0"
  2. Enter your JMARS user name and password. If you do not have a user name and password, follow the instruction under the appropriate "Getting Started" link on the Main Page.
    • At this point, the Layer Manager should only have the MOLA Shaded Relief Layer and the Lat/Lon Layer loaded.
  3. In the Lon/Lat box in the upper-left corner of the Viewing Window, enter the coordinates "175.5E, -14.5"
    • The Main View should now be centered over Gusev Crater.
  4. In the Layer Manager, click "Add New Layer" -> "Shape Layer", then click on the "Shape Layer" tab to access the focus panel.


Image:tutorial_7.1.png


  1. Creating a Shape File
  1. In "Files" section of the Shape Layer focus panel, highlight the "(untitled)" row.
  2. In the Main View, right-click and select "Add Features". The cursor should change to a red arrow.
  3. Place point features on some of the small craters within Gusev Crater by double-clicking on them with the red arrow.
    • As the points are added, new rows will appear in the "Features" section of the focus panel.


Image:tutorial_7.2.png


  1. Place a polyline along the prominent north-east rim of Gusev Crater. Single-clicks will place points between which lines will be drawn. Double-click on the last point to complete the polyline.
    • If the polyline is not selected, the default line thickness and color may make it difficult to see.


Image:tutorial_7.3.png


  1. Place polygons around some of the larger craters outside Gusev Crater. Single-clicks will place the corner points of the polygons, between which lines will be drawn. Close the polygon by adding a point on top of the first point.
    • Polygons must be closed shapes. If they are not closed they will register as polylines.


Image:tutorial_7.4.png


  1. In the "Features" section of the focus panel, specify labels for each of the features:
    • Highlight the five "point" rows, right-click in the "Label" column, select "Edit Column of Selected Rows", type "small crater" in the pop-up window and click "Ok".
    • Double-click on the "Label" cell in the "polyline" row and manually type "crater rim" in the description.
    • Highlight the three "polygon" rows, right-click in the "Label" column, select "Edit Column of Selected Rows", type "large crater" in the pop-up window and click "Ok".
  2. Save the features to a file by clicking on "Features" -> "Save All Features As". Specify a path, file name and a shape file type, then click "Save".
    • For many applications, a GML file is the easiest to deal with. However, you can also save the features as an ASCII File, ESRI Shape File or an MRO ROI File.
  3. At this point, the Shape Layer focus panel should look like the example below.


Image:tutorial_7.5.png


  1. Loading a Shape File
  1. At the top of the Shape Layer focus panel, click on "File" -> "Load File", select a shape file and click "Load".
  2. In the "Files" section of the focus panel, click on the name of the shape file you just loaded. This will display the features in the shape file in the "Features" section of the focus panel.


  1. Editing and Re-Saving a Shape File
  1. Load a shape file using the procedure above.
  2. To edit an existing feature, click on the feature in the Main View. Placing the mouse cursor over a point (either a stand-alone point or a corner of a polyline or polygon) will change the cursor to a blue cross. Left-click and drag points to edit the shape of a feature.
  3. To move an existing feature, click on it in the Main View and then left-click and drag it to a new position.
  4. To save the changes, select "Features" -> "Save All Features As" and overwrite the old file.


  1. Modifying the Features Using Shape Layer Scripts
  1. First, we will use a script to change the fill color of the large crater polygons.
  1. At the top of the Shape Layer focus panel, select "Feature" -> "Add Style Column" -> "Fill Color".
  2. In the focus panel, select "Scripts" -> "Edit Script". This will open a pop-up window for typing the scripts.
  3. Type the following command:
update set [Fill Color]= color(0,255,255) where Label like 'large crater'
  1. In the pop-up script window, select "Run" -> "Run"
  2. The Main View should then look like the example below:


Image:tutorial_7.6.png


  1. Second, we will use a script to simultaneously change the outline color and outline thickness of the large crater polygons.
  1. At the top of the Shape Layer focus panel, select "Feature" -> "Add Style Column" -> "Line Color".
  2. In the focus panel, select "Feature" -> "Add Style Column" -> "Line Width".
  3. In the focus panel, select "Scripts" -> "Edit Script". This will open a pop-up window for typing the scripts.
  4. Type the following command:
update set [Line Color]= color(0,0,0) where Label like 'large crater'
update set [Line Width]= 3 where Label like 'large crater'
  1. In the pop-up script window, select "Run" -> "Run"
  2. The Main View should then look like the example below:


Image:tutorial_7.7.png


  1. Third, we will use a script to shift the position of multiple features.
  1. At the top of the Shape Layer focus panel, select "Feature" -> "Add New Column", select "string" from the column-type menu, type "lat" in the column name field and click "Ok".
  2. In the "Features" section of the focus panel, enter the center latitude of each feature.
  3. In the focus panel, select "Scripts" -> "Edit Script". This will open a pop-up window for typing the scripts.
  4. Type the following command:
move rows (0.0, -0.5) where lat < -15
  1. In the pop-up script window, select "Run" -> "Run"
  2. The the bottom-right polygon (the only feature with a center latitude less than -15, was shifted -0.5 deg in latitude and 0 degrees in longitude. The Main View should now look like the example below:


Image:tutorial_7.8.png


  1. Fourth, we will use a script to select features that meet specific criteria.
  1. In the focus panel, select "Scripts" -> "Edit Script". This will open a pop-up window for typing the scripts.
  2. Type the following command:
select rows where Label="small crater"
  1. In the pop-up script window, select "Run" -> "Run"
  2. All of the points with the label "small crater" will be selected. In the Main View, they will appear with yellow outlines. In the focus panel, their rows will appear highlighted. Examples of both can be seen below:


Image:tutorial_7.9.png


Image:tutorial_7.10.png



Congratulations! You have finished the seventh JMARS tutorial!