Routines (alphabetical) > Routines: H > HDF-EOS Routines > EOS_SW_DEFBOXREGION

# EOS_SW_DEFBOXREGION

This function defines a longitude-latitude box region for a swath. It returns a swath region ID that is used by the EOS_SW_EXTRACTREGION function to read all the entries of a data field within the region. A cross track is within a region if its midpoint is within the longitude-latitude box (0), or either of its endpoints is within the longitude-latitude box (1), or any point of the cross track is within the longitude-latitude box (2), depending on the inclusion mode designated by the user. All elements within an included cross track are considered to be within the region even though a particular element of the cross track might be outside the region. The swath structure must have both Longitude and Latitude (or Colatitude) fields defined.

## Examples

In this example, we define a region bounded by 3 degrees longitude, 5 degrees latitude and 7 degrees longitude, 12 degrees latitude. We will consider a cross track to be within the region if its midpoint is within the region:

cornerlon[0] = 3.d

cornerlat[0] = 5.d

cornerlon[1] = 7.d

cornerlat[1] = 12.d

regionID = EOS_SW_DEFBOXREGION(swathID, cornerlon, cornerlat, 0)

## Syntax

Result = EOS_SW_DEFBOXREGION(swathID, cornerlon, cornerlat, mode)

## Return Value

Returns the swath region ID if successful and FAIL (–1) otherwise.

## Arguments

### swathID

Swath id (long) returned by EOS_SW_CREATE or EOS_SW_ATTACH.

### cornerlon

Longitude in decimal degrees (double) of box corners (double, 2 element, 1-D array).

### cornerlat

Latitude in decimal degrees (double) of box corners (double, 2 element, 1-D array).

### mode

Cross Track inclusion mode (long). Allowable values are:

- 0 = Midpoint
- 1 = Endpoint
- 2 = Anypoint

## Keywords

None

## Version History

5.2 | Introduced