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" -> "Shape"
- 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.
- The point may not be visible at first. To check that JMARS has registered the point, watch the "Features" column in the Focus Panel. The number of features will go up after a point has been added.
- 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.
- The polygon may not be visible after it is completed. To check that JMARS has registered the polygon, watch the "Features" column in the Focus Panel. The number of features will go up after a polygon has been added.
- 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 general shape files, use the .gml file type.
[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 point by clicking on it. (It should now be highlighted in yellow.) To move a corner point, left-click and drag it to a new location. To add a new corner, left-click on a line and chose "Add Point".
- Re-Save the Shape File: At the top of the Shape Layer focus panel, click "Features" -> "Save All Features As" and overwrite the existing shape file.
[edit] Editting the Shape Layer Settings
- 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.
- Show Labels:
- Fill Polygons: Fills the polygons with red to make them more visible
- Show Vertices: Show the corner points of the polygons
- Show Progress:
- Anti-aliasing:
- Line Width: Sets the width of the polygon lines (in pixels)
- Selected Line Width: Sets the width of the polygon lines when they are selected (in pixels)
- Selected Line Color: Sets the color of the polygon lines when they are selected

[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
