Buffer() function - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Purpose

Returns a region object that represents a buffer region (the area within a specified buffer distance of an existing object). You can call this function from the MapBasic window in MapInfo Pro.

Syntax

Buffer( inputobject, resolution, width, unit_name )

inputobject is an object expression.

resolution is a SmallInt value representing the number of nodes per circle at each corner.

width is a float value representing the radius of the buffer; if width is negative, and if inputobject is a closed object, the object returned represents an object smaller than the original object. If the width is negative, and the object is a linear object (line, polyline, arc) or a point, then the absolute value of width is used to produce a positive buffer.

unit_name is the name of the distance unit (e.g., "mi" for miles, "km" for kilometers) used by width.

Return Value

Returns a region object.

Description

The Buffer() function returns a region representing a buffer.

The Buffer() function operates on one single object at a time. To create a buffer around a set of objects, use the Create Object statement As Buffer. The object will be created using the current MapBasic coordinate system. The method used to calculate the buffer depends on the coordinate system. If it is NonEarth, then a Cartesian method will be used. Otherwise, a spherical method will be used.

Example

The following program creates a line object, then creates a buffer region surrounding the line. The buffer region extends ten miles in all directions from the line.

Dim o_line, o_region As Object 
o_line = CreateLine(-73.5, 42.5, -73.6, 42.8) 
o_region = Buffer( o_line, 20, 10, "mi") 

See Also:

Create Object statement, Set Buffer Version statement