CreateBuffers()

Summary

Creates buffers around features in a layer.

Syntax

CreateBuffers(string db_name, string output_layer_name, array sets, string method, array inputs, array options)

Argument Contents
db_name The name of the output geographic file
output_layer_name The output layer name
sets An array of input selection sets (currently only the first one is used)
method "Value", "To Value", or "Expression": "Value" means that the buffers have fixed sizes "To Value" indicates that the size of the buffer is dependent on the result of an "overlay" between itself and the other layer "Expression" is a mathematical function that could, but does not necessarily, depend on the attributes of each feature
inputs An array that is specific to the method:- If the method is "Value", then "inputs" will be an array of numerical values- If the method is "To Value", then "inputs" will be a two- or three-element array. The first part of the array is a full field spec for the polygon overlay, the second is an array of numerical values, and the third is optional tolerance value- If the method is "Expression", then "inputs" will be the expression
Option Type Contents
Exterior String "Merged" or "Separate"
Interior String "Merged" or "Separate"
Arcs Integer Number of arcs to be used to depict a circle
Units String Units of length to be used
Database Label String Label for database that is created
Preprocess String "True" to check for overpasses, underpasses, and duplicate lines before building the buffers, or "False" (default)
Name Field String A field in the current layer whose values will be copied to the corresponding buffer record in the output layer
Cumulative string "True" or "False" to create cumulative buffers, where outer buffers also include the areas of the inner buffers

Notes

  • The layer to be buffered must be the working layer.

  • CreateBuffers() creates buffers around any number of features in an input layer, and stores the buffers in a new geographic file. The buffers can be of fixed or variable sizes. When buffers are drawn around more than one feature, the buffers can be merged, or created separately around each feature (so that the buffers can overlap).

  • The default value for Exterior is Merged.

  • If the Exterior is Merged, the method must be Value or To Value.

  • If the Exterior is Separate, then the Interior must be Separate.

  • The default value for Arcs is 36. This number should be between 12 and 99.

  • The tolerance value for the To Value method is the acceptable error. Values greater than 1 are divided by 100 internally.

  • CreateBuffers() 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.

Example

// Before running the example, create a map by opening nycrests.cdf
// in the Tutorial folder.
on escape goto next // So Cancel button will be detected
// Build buffers at fixed ring sizes around each store.
folder = RunMacro("G30 Tutorial Folder")
CreateBuffers(folder + "mybuffers.dbd", "Restaurant Buffers", { }, "Value", {.25, .5},
{{"Exterior", "Merged"}, {"Interior", "Merged"}})
next:
on escape default
// To see the results, add mybuffers.dbd in the Tutorial folder to the map.

Error Codes

Error Meaning
Error Invalid input or the output database is in use
NotFound There is no current layer
Escape The user clicked Cancel

See Also

Function Summary
ColumnAggregate() Performs a geographic overlay between two layers and aggregates tabular data