Vector data processing
Vector data can be converted to rasters and combined into a single raster file using the following workflow. The general steps required are as follows:
- Clipping the vectors
- Validating and repairing the data
- Converting the vectors to rasters
- Combining raster layers
Vector data clipping
If necessary, the Clip tool in the Data Management toolbox can be used to extract only the features in the area of interest for your modeling purposes.
Data validation and repair
The following geoprocessing tools should be run on the vector data before creating rasters to avoid striping or bleeding that can occur. Both of these tools are in the Features toolset in the Data Management toolbox.
- Check Geometry—Generates a report of the geometry problems in a feature class.
- Repair Geometry—Inspects each feature in a feature class for geometry problems. Upon discovery of a geometry problem, a relevant fix will be applied, and a one line description will be printed identifying the feature as well as the problem encountered.
Vector to raster conversion
Before the vectors are converted to rasters, a proper cell size for the output raster must be determined. One strategy is to make all rasters the same cell size. However, creating a raster at a higher resolution than the vector data supports creates a raster that is unnecessarily large, without adding any detail. Creating a raster at too coarse a resolution will result in loss of detail. Therefore, a formula is used to calculate optimal cell size. We then alter the computed output cell size to conform to the nearest standard cell size. Below is an example using the Protected Areas Database of the United States (PADUS) dataset.
The methodology for this example is explained in detail in Hengl, T. 2006. Finding the right pixel size. Computers & Geosciences, 32(9): 1283-1298, last updated August 2007. The data is available online at http://spatial-analyst.net.
Note:All parameters are expressed in meters or square meters. Current values are from different case studies.
Delineation | Size (square meters) |
|---|---|
Average size of oval delineations | 6073484 |
Average width of narrow delineations | 500 |
90% smallest delineation | 8100 |
90% narrowest delineation | 22 |
95% smallest delineation | 4267 |
95% narrowest delineation | 13 |
99% smallest delineation | 2395 |
99% narrowest delineation | 10 |
Using the average size of oval delineations and average width of narrow delineations, the meters per side are calculated for the features. For both oval and narrow features, the 50th, 90th, 95th, and 99th percentiles are used to determine the best size for the grid. The scale based on the average size of the delineations is 194,832.
Spatial object shape | 50% | 90% | 95% | 99% |
|---|---|---|---|---|
Oval | 616.1 | 22.5 | 16.3 | 12.2 |
Narrow | 100.0 | 11.0 | 6.5 | 5 |
For this example, 22.5 meters per cell side was used, and was rounded to 30 meters to align with Landsat and its derivatives. The methodology is somewhat subjective since the definition of narrow or oval will vary by application and by analyst, so the algorithm in the table should be used as a guideline rather than a hard rule.
Once a cell size is determined, the vector data must then be assessed and passed through the applicable raster processing method: present/absent, categorical (key attribute), density, or distance.
Presence/Absence method
This method is used to rasterize a vector that only indicates presence or absence. This is useful for critical habitat, where an area of land is critical habitat for one or more species or not.
A field is added to the vector feature that contains a code indicating the absent or present status of the data. The field is then calculated to the desired value. Usually 1 means presence so the resulting raster has cell values of 1 where the variable is present. Once the field is calculated, one of the following geoprocessing tools in the Conversion toolbox can be used to convert the vector features to a raster dataset.
- Polyline To Raster—Converts polyline features to a raster dataset.
- Polygon To Raster—Converts polygon features to a raster dataset.
Categorical (key attribute) method
The raster is processed based on a key attribute that will be used to analyze a particular layer. An example is ecological systems. The raster could be created based on subclass, formation, or division, and each raster can be analyzed differently in order to produce a viable outcome. These results can then be used by anyone interested in that particular facet of that data layer. Once the field is selected, one of the following geoprocessing tools in the Conversion toolbox can be used to convert the vector features to a raster dataset.
- Polyline To Raster—Converts polyline features to a raster dataset.
- Polygon To Raster—Converts polygon features to a raster dataset.
Density method
Using the density methods you can create a raster based on the density of point or line features. For example, road density is a key raster layer for landscape analysis that is created by calculating the density of lines representing roads. The density of point source pollution would be an example of point density. Both the Line Density and Point Density tools are located in the Density toolset in the Spatial Analyst toolbox. You can choose to only calculate the density of the features, or you can choose a population field to weight the features (higher-weighted features are relatively denser for a specified population parameter). The resulting cells represent the density of lines or points per cell, in the selected units.
Distance method
The distance method creates cells that represent a certain distance to or from something. For example, it’s common to need to know how far any given cell is from a water source. For this calculation, use the Euclidean Distance tool in the Density toolset in the Spatial Analyst toolbox. This produces a raster with cell values representing the distance to the closest feature in the input vector.
Combining multiple raster layers (optional)
It may be necessary to combine multiple vector datasets into one output dataset. For example, critical habitat consists of both a line dataset (streams that are critical habitat for fish) and a polygon dataset (areas of land that are critical habitat for terrestrial animals). Both of these datasets are combined into one raster that is represents all critical habitat.
This process requires the following steps:
- Calculating null values to zero
- Merging the raster layers
- Calculating zero values to null
Calculating null values to zero
Calculate all null values to 0 so that all raster cells will be recognized and used during the calculation process to combine the multiple raster layers. On a cell-by-cell basis, the Bitwise Or tool in the Bitwise toolset in the Math toolset in the Spatial Analyst toolbox evaluates the binary representation of the input values. For each bit where one or both inputs are 1, the output is 1. If both bits are 0, the output is 0 for the bit.
The Raster Calculator tool in the Map Algebra toolset in the Spatial Analyst toolbox can be used to calculate the null values to zero. Before running the tool, set the Processing Extent environment setting to the boundary layer. Use the following parameter values to run the tool.
Parameter name | Value |
|---|---|
Map Algebra Expression |
|
Output raster | <working directory>\<name_rastercalc> |
Merging raster layers
Once the null values have been calculated to zero, you can merge the raster layers using the Bitwise Or tool in the Bitwise toolset in the Math toolset in the Spatial Analyst toolbox. Before running the tool, set the Processing Extent environment setting to the boundary layer. Use the following parameters to run the Bitwise Or tool.
Parameter name | Value |
|---|---|
Input raster 1 | <raster 1> |
Input raster 2 | <raster 2> |
Output raster | <working directory>/<name_merge> |
Calculating zero values to null
After the raster layers have been merged, the zero values need to be recalculated as null values to accurately portray areas where there is no data. This can be accomplished with the Raster Calculator tool that was used to calculate the null values as zero previously. This tool is located in the Map Algebra toolset in the Spatial Analyst toolbox.
Before running the tool, set the Processing Extent environment setting to the boundary layer. Use the following parameters to run the Raster Calculator tool.
Parameter name | Value |
|---|---|
Map Algebra Expression | SetNull("name_merge.tif","name_merge.tif","VALUE < 1") |
Output raster | <working directory>/<name_PA.tif> For example, \D_Raster\Raster_Analytical\CritHab_BullTrout_US_FWS_2011_PA.tif |