| Maptitude GISDK Help |
Caliper Script contains a number of functions you can use to create and manipulate arrays. In addition, the + operator concatenates two arrays.
| GISDK Function | Summary |
|---|---|
| ArrayElementToInteger() | Converts an array element to an integer |
| ArrayElementToReal() | Converts an array element to a real number |
| ArrayElementToString() | Converts an array element to a string |
| ArrayExclude() | Excludes elements from an array |
| ArrayIntersect() | Creates an array that contains the elements of the array a that are also in array b |
| ArrayLength() | Computes the number of elements in an array |
| ArrayMax() | Determines the largest value in an array of numbers |
| ArrayMin() | Determines the smallest value in an array of numbers |
| ArrayPosition() | Finds the position of a sub-array in an array |
| Avg() | Computes the average value of the elements of an array |
| CompareArrays() | Compares two arrays, element by element |
| CopyArray() | Makes a copy of the array, including nested sub-arrays, to any depth |
| ExcludeArrayElements() | Removes elements from an array |
| ExtractArray() | Returns the specified sub-array, which must itself be an array |
| FindOption() | Finds a particular option and its setting in an array of name-value pairs |
| FindOptionValue() | Finds the value of a particular option in an options array |
| FindStrings() | Finds strings in an array that match one or more search specs |
| GetArrayScope() | Returns the scope of an array of coordinates |
| InsertArrayElements() | Inserts elements into an array |
| JsonToArray() | Converts a proper JSON literal object to an options array |
| Kurtosis() | Returns the kurtosis of a set of numbers |
| LoadArray() | Loads an array from a file |
| Mean() | Computes the mean (average) of the elements of an array |
| Median() | Computes the median of the elements of an array |
| Percentile() | Returns the value at which a given percentile is reached |
| ReadArray() | Reads a text file into an array of strings |
| ReadSizedArray() | Reads a group of strings from a file |
| ReverseArray() | Returns a new array, with the same elements as the input array, but in the reverse order |
| SaveArray() | Saves an array to a file |
| ShowArray() | Displays a Windows dialog box containing the contents of an array, including nested sub-arrays |
| Skew() | Returns the skew of the values in an array |
| SortArray() | Sorts the elements of an array |
| Std() | Computes the standard deviation of an array of numbers |
| Subarray() | Extracts a number of elements from an array |
| Sum() | Computes the sum of an array of numbers |
| TransposeArray() | Transposes an array of arrays, where element b[i][j] = a[j][i] |
| Var() | Returns the variance on an array of numbers |
| WriteArray() | Writes the elements of an array to a text file |
| WriteArraySeparated() | Writes the elements of an array to a file, separated by a delimiter |
You can determine the length of an array using ArrayLength() or using the special syntax arrayname.length, as in:
n = names.length
ShowMessage ("There are " + String(n) + " names in the list")
Since you can concatenate arrays, you can increase the size of an array. Here an example, using array x from above:
x = { "New York", "Los Angeles", "Miami"}
y = { "Seattle", "Atlanta"}
x = x + y // x[4] equals "Seattle"
If you change the original array, the array that it is concatenated to will also be changed:
y[2] = {"Chicago"} // x[5] is now "Chicago" as well
To make a completely new copy of an array, use CopyArray().
You can build an array of any length at runtime by concatenating the desired number elements to the array. Note that a variable or array element must be placed in an array to do the concatenation:
window_array = GetWindows("All") // returns an array containing three arrays
map_names = null // initialize the variable for the new array
for i = 1 to window_array[2].length do
if window_array[2][i] = "Map" // type in second sub-array, name in first
then map_names = map_names + { window_array[1][i] }
end
Also note that this is very inefficient if the array may be large and you can dimension the array first. This executes slowly:
slow_array = null
for i = 1 to 1000 do
slow_array = slow_array + {i}
end
This executes much faster:
dim fast_array[1000]
for i = 1 to fast_array.length do
fast_array[i] = i
end
For more information, see...
| ©2025 Caliper Corporation | www.caliper.com |