Shape Layer
From JMARS Wiki
The Shape Layer, which is available in the THEMIS and MRO releases of JMARS, allows users to create and view files containing points and regions of interest. This layer is similar to the Region of Interest (ROI), except that it only allows users to specify geographical regions or locations without observation information and must be saved to a file rather than to a JMARS database.


[edit] Open the Shape Layer
- Open the Shape Layer: Chose "Add New Layer" -> "Shapes"
- Load a Shape File: At the top of the Shape Layer focus panel, click "File" -> "Load File". Select the desired shape file and click "Load".
[edit] Creating a Shape File
- Change to Add Mode: Right-click in the Main View and choose "Add Feature" from the list.
- Add a Point: Double-click on the location in the Main View where you want a point located.
- By default, the point will show up as a white square with a red center. This indicates that it's a stand-alone point and not a corner-point of a polygon.
- Adding a Polygon: Click on a location in the Main View where you want one of the polygon corners located. Then move to the next corner location and click again. To finish the polygon, click on the first point to close the shape.
- By default, the polygon will show up as a white outline will a red fill color.
- Adding a Polyline: Click on a location in the Main View where you want to start the line, then move to the next point of the polyline (non-linear line) and single-click to add a new point. When you reach the end, double-click to create the last point.
- Saving the Shape File: At the top of the Shape Layer focus panel, click "Feature" -> "Save All Features As". Specify a location, file name and file type and then click on "Save".
- For new users, the ESRI file format is recommended.
[edit] Editting a Point/Polygon
- Change to Edit Mode: Right-click in the Main View and chose "Select Features"
- Edit a Point: Select a point by clicking on it. (It should now be highlighted in yellow.) Left-click on the point and drag it to a new location.
- Edit a Polygon: Select a corner point by clicking on it. (It should now be highlighted in yellow.) To move the corner point, left-click and drag it to a new location. To add a new corner point, left-click on a line, chose "Add Point" and then drag the new point to it's final position.
- Edit a Polyline: Similar to editing a polygon, select the line by clicking on it. (It should now be highlighted in yellow.) To move the point, left-click and drag it to a new location. To add a new point, left-click on a line, chose "Add Point" and then drag the new point to it's final position.
- Re-Save the Shape File: At the top of the Shape Layer focus panel, click "Features" -> "Save All Features As". Users can either create a new shape file or overwrite the existing shape file.
[edit] Editting the Shape Layer Columns
- The properties of each object currently loaded in the Shape Layer (points, polylines and polygons) are shown in the "Features" table of the focus panel. By default, the only columns visible are the basic display parameters of each object.
- Open the Column Editor: In the "Shape Layer" focus panel, click "Feature" -> "Edit Columns"
- Delete Existing Columns: All of the existing columns in the focus panel table are displayed in the left-hand box.
- Edit the Shape Layer Settings: At the top of the Shape Layer focus panel, click on "Settings" to open the Settings Window.
- Shape Layer Name: This field allows users to change the name of the shape layer, which will be reflected in the Layer Manager.
[edit] Writing Shape Layer Scripts
Users can write simple scripts to automatically edit the parameters of the various features in a shape file, which is especially useful when a file has a large number of features in it. The command language is similar to SQL, but has many differences:
- Color columns are specified by a color_spec (e.g. color(255,255,255) ). The order of the elements in a "color spec" are color( red, green, blue). The colors must be an integer between 0 and 255, inclusive.
- Selecting anything other than the entire row is undefined. Therefore, selection must be preceeded by the string "select rows" or "select *".
- An "update set" query changes the column to the specified value in all the rows selected by the predicate.
- A "move rows" query will move all the rows specified in a where clause by the specified delta .
The following are some basic instructions for getting started. For more information on writing and applying shape layer scripts, read the Using the Shape Layer tutorial.- Open a New Script: At the top of the Shape Layer focus panel, chose "Scripts" -> "Edit Script". A blank pop-up window will open.
- Write a Script: A script will have three components: an operation, an instruction and a set of rows where the operation will be applied.
- Operations: An SQL-type command such as "update", "select" or "move".
- Instructions: An SQL-type command such as "set[field1]=XXX"
- Set of Rows: An SQL-type specification such as "where field2 like 'XXXXX'"
- Examples:
- update set [Fill Color]= color( 255,255,0) where Label like 'Crater'
- changes the fill color to yellow in every row that has a label which consists of the single word "Crater"
- update set [Fill Color]= color( 255,255,0) where Label like 'Crater'
- update set PERIMETER = AREA + 100
- sets the value of the perimeter column to that of the area column plus 100 in all rows
- update set PERIMETER = AREA + 100
- select rows where AREA > 50.00
- turns selection on in all the rows where the Area column has a value greater than 50
- select rows where AREA > 50.00
- move rows (0.0, 1.0) where lon > 0
- moves all the rows with center longitudes greater than zero 1 degree up
- move rows (0.0, 1.0) where lon > 0
[edit] Related Pages
- Tutorial #7: Using the Shape Layer

