ComputeIntersectionPercentages()
Summary
Intersects two or more area or line layers and computes the intersection percentages.
Syntax
ComputeIntersectionPercentages(array layer_sets, string table, array options)
| Argument | Contents |
|---|---|
| layer_sets | The layer and/or set names of area or line features to intersect |
| table | The filename of the table to create; the file extension must be one of .BIN, .CSV, .DBF, or .TXT |
| Option | Type | Contents |
|---|---|---|
| Database | String | The path and file name for the resulting geographic database; or null if you do not want to produce a geographic file |
| Label | String | A descriptive label for the geographic file |
| Layer Name | String | The name of the layer in the geographic file |
| Optimize | Boolean | If "True" (default), and the Database option is specified, the database will be optimized, otherwise "False" |
Notes
-
For areas, ComputeIntersectionPercentages() takes two or more area layers and/or sets and intersects all the boundary edges to create a new area database. For each resulting area, the data table contains a record with the original feature ID from each layer and the percentage of the original area size for each layer.
-
For lines, ComputeIntersectionPercentages() takes two or more line layers and/or sets and intersects all the lines to create a new line database. For each resulting line, the data table contains a record with the original feature ID and a percent of 1 for the source layer and either:
-
A null value for the ID and a percent of 0 for the other layer(s), or
-
Where they overlap the ID of the line with which it overlaps and a percent of 1.
-
-
You cannot mix layer types. They must all be either area layers or line layers. The layer type is determined from the input layers.
-
ComputeIntersectionPercentages() can also operate on a single layer, for example finding where the lines of a line layer intersect each other or themselves.
-
ComputeIntersectionPercentages() displays a progress bar. To add a Cancel button to the progress bar, precede the function call with an "on escape" clause. For more information, see Error Handling.
-
The total number of areas that can be intersected is limited by the amount of available memory.
Example
// Before running the example, create a map by opening manh_zip.cdf and add the
// layer manhtrct.cdf, both in the Tutorial folder.
folder = RunMacro("G30 Tutorial Folder")
ComputeIntersectionPercentages({"Tract", "5-Digit Zip"}, folder+"myintersect.dbf",
{{"Database", folder + "myoverlay.dbd"}, {"Optimize", "False"}})
// Open myintersect.dbf and myoverlay.dbd in the Tutorial folder
// to see the results.
Error Codes
| Error | Meaning |
|---|---|
| NotFound | One or more of the layer or sets does not exist |
| Error | An argument or option has the wrong type or the wrong number of values; or an error occurred while processing the data; or no layer or sets are specified; or they are specified incorrectly. |
| Escape | The user clicked Cancel |
See Also
| Function | Summary |
|---|---|
| AggregateTable() | Groups records in a view and computes summary statistics |
| ApplyOverlayTable() | Computes attribute values for a view using information from an overlay table |
| ColumnAggregate() | Performs a geographic overlay between two layers and aggregates tabular data |
| MergeByValue() | Creates districts by merging areas from a geographic file, based on the value of a field |
| MergeGeography() | Merges features from one layer into another |
| SelfAggregate() | Groups the records in a view, based on a field, to create an aggregate view |