Vectors
Vectors are points, multipoints, polylines, or polygons used to mark areas of interest within an image. Use the Vector toolbar buttons to work with vectors. For additional details on vectors, see Vector Records Background.
ENVI supports shapefiles (.shp
, excluding Z and M polygons), GeoJSON (.json
, .geojson
read-only support), and ENVI vector files (.evf
) and OGC GeoPackage vector file (.gpkg
). See Vector Auxiliary Files Background for a list and description of the auxiliary files that ENVI creates on your local drive when opening vector files for the first time.
See the following sections:
- Create and Save Vector Layers as Shapefiles
- Create Vector Layers from ASCII Data as Shapefiles
- Add Vectors
- Edit or Delete Vectors
- Change Properties for Vectors
- View Attributes for Vectors
- Filter Vector Records by Attributes
- Zoom Options
Create and Save Vector Layers as Shapefiles
- Create a new layer by selecting File > New > Vector Layer from the menu bar.
- Each layer may contain only one Record Type (for example, points).
- You can select a Source Data file when creating an new layer to define the new layer’s extents and map projection using an existing file.
- ENVI performs Real-Time Ortho for vector layers created on top of an RPC image. The vector layers will contain projected coordinates that can display with other projected imagery, and projected vector layers will display on top of an existing RPC image without reprojecting the RPC image.
- When the layer has been modified, the icon next to the layer name in the Layer Manager becomes shaded . The icon shading is removed once the layer is saved.
- Save layer changes by right-clicking in the Image window view and selecting Save.
- Save layer changes to a new file by right-clicking in the Image window and selecting Save As. Also use Save As when saving a new vector layer for the first time.
- Saving the new layer creates a new attribute table, which consists of the numeric attribute RECORD_ID.
- To hide a vector layer in a view, disable the check box for that layer in the Layer Manager. To show the layer, enable the check box. Or, right-click on the View icon in the Layer Manager and select Show All Layers and Hide All Layers to show/hide all layers at once.
- To rename a layer, right-click its name and select Rename Item. Enter the new name in the Rename Item dialog and press the Enter key to accept it or press the Esc key to cancel. (Linux and Mac users should click the green check icon to accept the new name or click the red X icon to cancel.)
- To remove a vector layer from the Layer Manager, right-click on the layer and select Remove. This removes the layer from the Layer Manager, but the file remains open and you can access it for redisplay from the Data Manager.
- If you have multiple views displayed, you can drag-and-drop vector layers from the Layer Manager to any one of those views in the display or to the corresponding view icons in the Layer Manager. This creates a copy of the layer(s) to populate the views.
- To add a vector layer to a new view, right-click on a filename in the Data Manager and select Open Selected Dataset in New View.
- Each time you open a new vector file, the layer appears at the top of the Layer Manager and becomes the selected layer. The purpose of a selected layer is to allow you to apply a display enhancement (transparency, etc.) to that layer only, without affecting other layers. To select a layer, click its name in the Layer Manager.
Create Vector Layers from ASCII Data as Shapefiles
You can create point, multi-point, polyline, or polygon vector layers from ASCII text files or comma-separated value (CSV) files that contain data and geolocation values. An example is creating a point-based shapefile from an ASCII file that contains GPS records. You can only create new vector layers from ASCII data; you cannot add records to an existing vector layer.
You can write a script to create vector layers from ASCII data using the ASCIIToVector task.
If the data contain a combination of numeric and text values, they must be separated by commas. If the data consist entirely of numeric values, they can be separated by spaces or commas. You can add records to a new or existing ROI. ENVI will ignore any header information or column labels.
Tip: The ENVI Feature Counting Tool provides an option to export feature counts to CSV files or ASCII reports.
Follow these steps:
- Create a new layer by selecting File > New > Vector Layer from the menu bar. The Create New Vector Layer dialog appears.
- Enter an optional Layer Name.
- From the Record Type drop-down list, select the type of vector record to create. The choices are Point, Multipoint, Polyline, or Polygon (default).
- In the Source Data list, select the source data that will define the new layer’s extents and map projection.
- Click OK.
- Select the vector layer in the Layer Manager to make it the active layer. The Create Vector tool becomes active in the ENVI toolbar.
- Right-click in the Image window and select Import from ASCII. The Select Input Coordinates File dialog appears.
- Select an ASCII text file (
.txt
) or CSV file (.csv
) with the records you want to import and click Open. The Import from ASCII dialog appears. - In the X field of Data Columns, select the column number that contains longitudes or eastings.
- In the Y field of Data Columns, select the column number that contains latitudes or northings.
- Select the Coordinate System of the imported ASCII data. See Select Coordinate Systems for further instructions. The default is Geographic Lat/Lon WGS-84.
- Click OK.
The File Preview section shows the columns of data that were imported; for example:
Using the example above, the X field is column #3 since that column contains longitudes. The Y field is column #2 since that column contains latitudes:
Add Vectors
You can add vectors to shapefiles and EVFs only.
- In the active layer, click the Vectors drop-down on the toolbar and select Vector Create, then click on the image where you want to add the vector.
- Create polygons or polylines by clicking and dragging to draw them, or click at intervals to add vertices one at a time.
- Use the right-click menu options to accept vectors when they are drawn.
- Multipoint vectors can be added only to a vector file that is designated a multipoint file.
- Group or ungroup vectors by selecting them and using the right-click menu options.
- Editing a vector layer with an associated attribute table does not change the existing attribute values. Depending on the type of edits you make, this may mean the values in that record are no longer valid.
Edit or Delete Vectors
You can edit or delete vectors in shapefiles and EVFs only. The options include: delete a record, move a polyline or polygon vertex, add or delete a polyline or polygon vertex, group or ungroup records. join polylines, merge or split polylines or polygons, smooth polygons, rectangulate polygons. and remove polygon holes.
- To edit or delete polygon or polyline records in the active layer, click the Vectors drop-down on the toolbar and select Vector Edit.
- To edit or delete points in the active layer, click the Vectors drop-down on the toolbar and select Vertex Edit.
- Select a record by clicking on it.
- Select multiple records by using Ctrl+click, or by clicking and dragging to draw a box around the records.
- Use the right-click menu to choose edit or delete options for the selected record(s).
Change Properties for Vectors
Changing properties works for all supported vector types. The properties of a vector layer are displayed below the ENVI Toolbox; for example:
You can edit the basic properties directly in this panel.
To edit the display properties for a given attribute, right-click on a vector layer in the Layer Manager and select Properties. In the Vector Properties dialog, select an attribute name from the Attribute drop-down list. The Attribute Values section on the left side of the Vector Properties dialog lists the unique values for that attribute.
- Use the top table to edit the display properties of a selected attribute.
- The Fill Interior property is disabled for any polygon layer that is the active layer, when the Vector Edit or Vertex Edit tool is in use.
- When you display a vector file for the first time, the Vector Properties dialog assigns a default fill color of red for all attributes.
- To change the fill color for all values for the selected attribute, select the Solid Color option from the Color Table drop-down list. Otherwise, select different color options as needed. For example, you could assign different colors to different road types such as dirt, multi-lane, etc. A preview of the currently selected color table is displayed below the drop-down list.
- For polygon shapefiles, if the Fill Interior property is set to True and you select an option from the Color Table drop-down list (besides Solid Color), the Line Color property in the top table is automatically set to black. You can change this if needed. If the Fill Interior property is set to False and you select a color table, the outlines of the polygons are colored according to the selected color table.
- If the Fill Interior property is set to True for polygon shapefiles, the fill is temporary disabled if you use the Pan, Fly, or Rotate tools to move around the display.
- If the attribute has more than 256 unique values, the selected color table is equally divided among the number of attributes, creating a color gradient. Select the Cycle Color Table option if you want the color table to repeat itself with each iteration of 256 unique values.
- Click Apply to commit your changes to the Image window.
Attribute Values
To edit the display properties of a specific attribute value, select the value in the Attribute Values list. Use the bottom table to edit the color properties for that value.
Here are some tips for working with vector files that have more than 256 unique attribute values:
- The Attribute Values list only shows 256 values at a time. Click the and buttons to navigate through pages of attribute values. Or, click the and buttons to go to the first or last page of values. The window to the right of the buttons indicates the range of records you are currently viewing.
- Clicking the Attribute Value Index button displays a dialog that divides all of the unique attribute values into smaller categories, to help you quickly locate a specific attribute value. The following example shows unique "name" attribute values for world airports. In the Attribute Value Index dialog, suppose you want to find the Hong Kong International Airport. Click on the value before Hong Kong, which in this case is Halifax Int'l. The Attribute Value Index dialog shows a more detailed level of values that start with that selection. Click Hong Kong Int'l. At this point, you can edit the vector properties for Hong Kong Int'l, or you can continue to find other attribute values. In the Attribute Value Index dialog, click the Prev Level button if needed to return to the previous group of values.
Save Vector Symbology
Saving vector symbology is supported for shapefiles and GeoJSON. Once you have modified the display properties of a vector layer, you can save the symbology settings for later use. Click the Symbology drop-down list and select Save/Update Symbology File. ENVI saves the symbology to a .evs
file with the same root name as the vector file. By default, the symbology file is written to the same directory as the vector file. However, when that directory is read-only, the symbology file is written to the Auxiliary File Directory.
Each time you reopen the vector file, ENVI applies the styles defined in the associated symbology file (if it is present). You can select Save/Update Symbology File after making further changes. Or, if you do not like the changes you have made, select Apply Default Symbology to revert back to the styles defined in the symbology file.
To delete the symbology file completely, select Delete Symbology File. The vector layer then uses ENVI's default colors and styles.
View Attributes for Vectors
Viewing attributes works for all supported vector types. If a vector layer has an associated attribute table, you can open and view the attributes. Right-click on the layer name in the Layer Manager and select View Attributes to open the Attribute Viewer.
Filter by Attributes
Filtering by attributes works for all supported vector types. If a vector layer has an associated attribute table, you can filter the records by one or more attributes. Right-click the layer name in the Layer Manager and select Filter Records by Attributes to open the Filter by Attributes dialog.
Zoom Options
Zoom options work for all supported vector types.
- To zoom to the full extent of a given vector layer, right-click on the layer name in the Layer Manager and select Zoom to Layer.
- Selecting Full Extent from the Zoom drop-down menu or clicking the Zoom to Full Extent button in the main toolbar zooms to the combined extents of all layers for the current view.
- If a vector layer is georeferenced, the Zoom To drop-down list in the main toolbar displays options for Map Scale: