Maptitude Help / Formulas, Conditions, and Functions / Functions

Functions

The following functions are available in Maptitude. Note that function names are not case sensitive. The functions are grouped into functions for strings, functions for numbers, and functions for converting between strings and numbers. This section also describes conditional expressions.

For clarity, most of the examples use string or numeric constants as arguments. You can use any value as an argument, including a formula, condition, or function, as long as it is of the correct type.

This is just a subset of the functions that are available when you use the GIS Developer’s Kit (GISDK) to create add-ins, custom applications, or map servers. For more information on GISDK, choose Help>GISDK Help.

In this topic:

String Functions

   Left (string, number)   

   Description:   Returns the leftmost number of the characters in string.

   Arguments:   string – any string

      number – any number up to the number of characters in string

   Returned value:   A string of the number leftmost characters of string

   Examples:   Left (“New York City”,8) returns “New York”

      Left (“the greatest”,8) returns “the grea”

   Len (string)

   Description:   Returns the length (number of characters) of string.

   Arguments:   string – any string

   Returned value:   A value equal to the number of characters in string

   Examples:   Len (“New York City”) returns 13

      Len (“equal ”) returns 6

   Lower (string)

   Description:   Converts string to all lower case.

   Arguments:   string – any string

   Returned value:   A string equal to string changed to all lower case

   Examples:   Lower (“New York City”) returns “new york city”

      Lower (“PLEASE REDUCE THE”) returns “please reduce the”

   Lpad (string, length)

   Description:   Makes string length characters long by adding spaces in front.

   Arguments:   string – any string

      length - the desired length of the string

   Returned value:   A string that is length characters long

   Example:   Lpad (“Hello”, 10) returns “     Hello”

   Position (string1, string2)

   Description:   Finds the location of string2 in string1.

   Arguments:   string1 – the string to be searched

      string2 – the string to search for

   Returned value:   A number indicating the character position in string1  where string2  was found, or zero if the string2 is not found in string1

   Examples:   Position (“ABCDEFGHIJK”, “CDE”) returns 3

      Position (“ABCDEFGHIJK”, “Maptitude”) returns 0

   Proper (string)

   Description:   Converts string to initial caps.

   Arguments:   string – any string

   Returned value:   A string equal to string changed to initial caps

   Examples:   Proper (“NEW YORK CITY”) returns “New York City”

      Proper (“please reduce the”) returns “Please Reduce The”

   Right (string, number)

   Description:   Returns the rightmost number of the characters in string.

   Arguments:   string – any string

      number – any number up to the number of characters in string

   Returned value:   A string of the number rightmost characters of string

   Examples:   Right (“annual sales of $12 million”,14) returns “of $12 million”

      Right (“Boston MA”,2) returns “MA”

   Rpad (string, length)

   Description:   Makes string length characters long by adding spaces at the end.

   Arguments:   string – any string.

      length - the desired length of the string

   Returned value:   A string that is length characters long

   Example:   Rpad (“Hello”, 10) returns “Hello     ”

   Substitute (input, find, replace, n)

   Description:   Replaces the nth occurrence of the find string with the replace string. If n is omitted, all occurrences are substituted. You must include all three commas.

   Arguments:   input – any string

      find – the string to be replaced

      replace – the string to replace with

      n – a number indicating which occurrence to substitute

   Returned value:   Returns the modified string

   Examples:   Substitute (“input string”, “in”, “out”,1) returns “output string”

      Substitute (“input string”, “in”, “out”, ) returns “output stroutg”

   Substring (string, start, length)

   Description:   Returns the portion of string starting at the start character and including the following length characters.

   Arguments:   string – any string

      start – a number corresponding to the number of characters from the left end of string where you want to start the substring. Note that start must be smaller than the total number of characters in string

      length – a number corresponding to the number of characters of string you want to include in the substring

   Returned value:   A string, starting with the start character of string, and including length characters

   Examples:   Substring (“New York City”,5,4) returns “York”

      Substring (“for a=25”,7,2) returns “25”

   Trim (string)

   Description:   Trims leading and trailing spaces from string.

   Arguments:   string – any string

   Returned value:   string without leading or trailing spaces

   Examples:   Trim (“     every three digits     ”) returns “every three digits”

      Trim (“equal to     ”) returns “equal to”

   Upper (string)

   Description:   Converts string to all upper case.

   Arguments:   string – any string

   Returned value:   A string equal to string changed to all upper case

   Examples:   Upper (“New York City”) returns “NEW YORK CITY”

      Upper (“the 23rd”) returns “THE 23RD”

   Word (string, n)

   Description:   Finds the nth word in string.

   Arguments:   string – any string

      n – any number

   Returned value:   A string consisting of the nth word in string, or an empty string if string is less than n words long

   Examples:   Word (“New York City”, 2) returns “York”

      Word (“Maptitude”, 3) returns “” (an empty string)

Numeric Functions

   Abs (value)

   Description:   Converts value to an absolute value.

   Arguments:   value – any number

   Returned value:   A value equal to the absolute value of value

   Examples:   Abs (245) returns 245

      Abs (-245) returns 245

      Abs (-32.75) returns 32.75

   Acos (value)

   Description:   Returns the arccosine of value.

   Arguments:   Value – any number between -1 and 1

   Returned value:   A value equal to the angle in radians whose cosine is value

   Examples:   Acos (0.50) returns 1.05

      Acos (-0.50) returns 2.94

   Acosh (value)

   Description:   Returns the hyperbolic arccosine of value.

   Arguments:   value – any number greater than or equal to 1

   Returned value:   A value equal to the number whose hyperbolic cosine is value

   Examples:   Acosh (3) returns 1.76

      Acosh (300) returns 3.40

   Asin (value)

   Description:   Returns the arcsine of value.

   Arguments:   value – any number between -1 and 1

   Returned value:   A value equal to the angle in radians whose sine is value

   Examples:   Asin (0.5) returns 0.524

      Asin (-0.5) returns -0.524

   Asinh (value)

   Description:   Returns the hyperbolic arcsin of value.

   Arguments:   value – any number

   Returned value:   A value equal to the number whose hyperbolic sine is value

   Examples:   Asinh (-2.5) returns 1.647

      Asinh (10) returns 2.998

   Atan (value)

   Description:   Returns the arctangent of value.

   Arguments:   value – any number

   Returned value:   A value equal to the angle in radians (from -pi/2 to pi/2) whose tangent is value

   Examples:   Atan (1.0) returns 0.785

      Atan (300) returns 1.567

   Atanh (value)

   Description:   Returns the hyperbolic arctangent of value.

   Arguments:   value – any number greater than -1 and less than 1

   Returned value:   A value equal to the number whose hyperbolic tangent is value

   Examples:   Atanh (0.5) returns 0.549

      Atanh (-0.5) returns -0.549

   Atan2 (y_num, x_num)

   Description:   Returns the angle between the x-axis and the coordinates x_num, y_num.

   Arguments:   x_num – any positive or negative number

      y_num – any positive or negative number

   Returned value:   A value equal to the angle, in radians, between the x-axis and the coordinates x_num, y_num. The returned value lies between -pi and pi, excluding -pi. If both x_num and y_num = 0, atan2 returns a Divide-by-Zero error

   Examples:   Atan2 (25,10) returns 0.381

      Atan2 (0,25) returns 1.571

   Ceil (value)

   Description:   Returns the next larger integer after value.

   Arguments:   value – any number

   Returned value:   A value equal to the next larger integer after value

   Examples:   Ceil (3.72) returns 4

      Ceil (-2.75) returns -2

   Cos (value)

   Description:   Returns the cosine of the angle value.

   Arguments:   value – any angle, expressed in radians

   Returned value:   A number between 0 and 1

   Examples:   Cos (0.7) returns 0.765

      Cos (1.2) returns 0.362

   Cosh (value)

   Description:   Returns the hyperbolic cosine of value.

   Arguments:   value – any angle, expressed in radians

   Returned value:   A number, in radians, representing the hyperbolic cosine of value

   Examples:   Cosh (1.5) returns 2.35

      Cosh (-10) returns 11013.23

   Exp (value)

   Description:   Returns the value of the constant e raised to the power value.

   Argument:   value – any number

   Returned value:   The value of the constant e raised to the power value

   Examples:   Exp (2) returns 7.389

      Exp (-1.9) returns 0.150

   Factorial (value)

   Description:   Returns the factorial of value.

   Arguments:   value – any integer

   Returned value   The factorial (n!) of value

   Examples:   Factorial (6) returns 720

      Factorial (25) returns 1.55 x 1025

   Floor (value)

   Description:   Returns the next smaller integer before value.

   Arguments:   value – any number

   Returned value:   A value equal to the next smaller integer before value

   Examples:   Floor (3.72) returns 3

      Floor (-2.75) returns -3

   Log (value)

   Description:   Returns the value of the natural logarithm of value.

   Argument:   value – any number

   Returned value:   The value of the natural logarithm (base e) of value

   Examples:   Log (2) returns 0.693

      Log(4.87) returns 1.583

      Log (1002.38) returns 6.910

   Log10 (value)

   Description:   Returns the value of the common logarithm of value.

   Argument:   value – any number

   Returned value:   The value of the common logarithm (base 10) of value

   Examples:   Log10 (2) returns 0.301

      Log10 (4.87) returns 0.688

      Log10 (1002.38) returns 3.001

   Max (x, y)

   Description:   Returns the larger of x and y.

   Arguments:   x – any number

      y – any number

   Returned value:   A value that is the larger of x and y

   Examples:   Max (243.7, 443.2) returns 443.2

      Max (24, -42) returns 24

   Min (x, y)

   Description:   Returns the smaller of x and y.

   Arguments:   x – any number

      y – any number

   Returned value:   A value that is the smaller of x and y

   Examples:   Min (23, 25) returns 23

      Min (243.7, 443.2) returns 243.7

      Min (24, -42) returns -42

   Mod (x, y)

   Description:   Returns the remainder (modulus) of x/y.

   Arguments:   x – any number

      y – any number

   Returned value:   A value that is the remainder of the calculation x/y

   Examples:   Mod (23,7) returns 2

      Mod (256,9) returns 4

      Mod (-442.2,5) returns -2.2

   Pow (x, y)

   Description:   Returns the value of x to the y power.

   Arguments:   x – any number

      y – any number

   Returned value:   A value that is x to the y power

   Examples:   Pow (2,3) returns 8

      Pow (7.2,2.5) returns 139.10

      Pow (3,-2) returns 0.111

   RandomNumber ()

   Description:   Generates a random number between 0.0 and 1.0.

   Arguments:   none

   Returned value:   A pseudo-random real number between 0.0 and 1.0

   Examples:   RandomNumber () returns a different number each time

   Round (value, decimals)

   Description:   Returns value rounded to decimals places.

   Arguments:   value – any number

      decimals – an integer

   Returned value:   A value equal to value rounded to decimals places

   Examples:   Round (3.42, 0) returns 3

      Round (3.72, 0) returns 4

      Round (3.72, 1) returns 3.7

      Round (-3.42, 1) returns -3.4

   Sign (number)

   Description:   Returns the sign of a number.

   Arguments:   number – any number

   Returned value:   Returns -1 if the number is less than zero, 1 if it is greater than zero, or 0 if it is equal to zero

   Examples:   Sign(3.4) returns 1

        Sign(-18) returns -1

        Sign(0) returns 0   

   Sin (value)

   Description:   Returns the sine of the angle value.

   Arguments:   value – any angle, expressed in radians

   Returned value:   A number between 0 and 1

   Examples:   Sin (1.0) returns 0.841

      Sin (1.5) returns 0.997

   Sinh (value)

   Description:   Returns the hyperbolic sine of the angle value.

   Arguments:   value – any angle, expressed in radians

   Returned value:   A number representing the hyperbolic sine of the angle value

   Examples:   Sinh (3) returns 10.02

      Sinh (0.7) returns 0.759

   Sqrt (value)

   Description:   Returns the value of the square root of value.

   Arguments:   value – any number

   Returned value:   A value that is the square root of value

   Examples:   Sqrt (16) returns 4

      Sqrt (12) returns 3.464

   Tan (value)

   Description:   Returns the tangent of the angle value.

   Arguments:   value – any angle, expressed in radians

   Returned value:   A number representing the tangent of the angle value

   Examples:   Tan (0.785) returns 0.992

      Tan (1.5) returns 14.1

   Tanh (value)

   Description:   Returns the hyperbolic tangent of the angle value.

   Arguments:   value – any angle, represented in radians

   Returned value:   A number representing the hyperbolic tangent of the angle value

   Examples:   Tanh (-2) returns -0.964

      Tanh (0.5) returns 0.462

      Tanh (4) returns 0.999

Conversion Functions

   Char (i)

   Description:   Changes i to the corresponding character in the ASCII table.

   Arguments:   i – an integer between 0 and 255

   Returned value:   A string of one character, whose ASCII value is i.

   Examples:   Char (32) returns “ “ (a blank character)

      Char (75) returns “K”

      Char (107) returns “k”

      Char (189) returns “½”

   CreateDate (day, month, year)

   Description:   Changes day, month, and year into a DateTime compound variable.

   Arguments:   day – day number

      month – month number

      year – year number

   Returned value:   A DateTime compound variable with the time properties null.

   Example:   CreateDate(3,1,2013) returns a DateTime compound variable containing the date 03Jan2013

   CreateDateTime (day, month, year, hour, minute, second, millisecond)

   Description:   Changes day, month, year, hour, minute, second, and millisecond into a DateTime compound variable.

   Arguments:   day – day number

      month – month number

      year – year number

      hour – hour number in 24-hour format

      minute – minute number

      second – second number

      millisecond – millisecond number

   Returned value:   A DateTime compound variable.

   Example:   CreateDateTime(3,1,2013,11,22,19,48) returns a DateTime compound variable containing the date 03Jan2013 and the time 11:22:19.48 AM

   CreateTime (hour, minute, second, millisecond)

   Description:   Changes hour, minute, second, and millisecond into a DateTime compound variable.

   Arguments:   hour – hour number in 24-hour format

      minute – minute number

      second – second number

      millisecond – millisecond number

   Returned value:   A DateTime compound variable with the date properties null.

   Example:   CreateDateTime(11,22,19,48) returns a DateTime compound variable containing the time 11:22:19.48 AM

   Format (num, fmt)

   Description:   Formats num according to fmt into a string.

   Arguments:   num – any numeric value
fmt – the desired format

   Returned string:   a string that has:

      • at least as many digits to the left of the decimal as there are zeros to the left of the decimal in fmt

      • at most as many digits to the left of the decimal as there are zeros and number signs to the left of the decimal in fmt

      • at least as many digits to the right of the decimal as zeros to the right of the decimal in fmt

      • at most as many digits to the right of the decimal as there are zeros and number signs to the right of the decimal in fmt

      • a leading dollar sign if a dollar sign appears in fmt

      • commas every three digits if a comma appears in fmt

      • exponential notation if ‘e’ or ‘E’ appears in fmt

      • at least as many digits in the exponent as zeros to the right of the ‘e’ in fmt

      • at most as many digits in the exponent as zeros and number signs to the right of the ‘e’ in fmt

      • extra digits to the right of the decimal are rounded

      • extra digits to the left of the decimal cause an overflow and result in a string of all number signs

      • if a “*” appears to the left of the decimal, Maptitude uses as many digits as are necessary

   Examples:   Format (123.456, "$0,000.00") returns "$0,123.46"

      Format (123.456, “#.000e00”) returns “1.2346e+02”

      Format (100, “#.00##E##”) returns “1.00E+2”

      Format (-24.6835, “#0.00###”) returns -24.6835”

   FormatDateTime (datetime, fmt)

   Description:   Formats datetime according to fmt into a string.

   Arguments:   datetime – DateTime compound variable

      fmt – the desired format

   Returned string:   A string formatted based on the Standard System Formats and/or DateTime specifiers.

   Examples:   If dt is created with CreateDateTime(3,1,2013,22,11,19,48) then:

      FormatDateTime(dt,) returns “1/3/2013 10:11:19 PM”

      FormatDateTime(dt,”ddMMMyyyy”) returns “03Jan2013”

      FormatDateTime(dt,”HH:mm:ss”) returns “22:11:19”

   IntToString (i), I2S (i)

   Description:   Changes i to the string representation of the integer value.

   Arguments:   i – any integer

   Returned value:   A string representing the value of i

   Examples:   IntToString (123) returns “123”

      I2S (73) returns “73”

   ParseDateTime (string, fmt)

   Description:   Formats string according to fmt into a DateTime compound variable.

   Arguments:   string – DateTime compound variable

      fmt – the desired format

   Returned string:   A string formatted based on the Standard System Formats and/or DateTime specifiers.

   Examples:   ParseDateTime(“1/3/2013 10:11:19 PM”,) returns a DateTime compound variable with the date 1/3/2013 and the time 10:11:19 PM

      ParseDateTime(“2013.1.3 22:9:43”,”yyyy.M.d HH:m:s”) returns a DateTime compound variable with the date 1/3/2013 and the time 10:09:43 PM

   RealToInt (n), R2I (n)

   Description:   Changes n to an integer value.

   Arguments:   n – any real number

   Returned value:   An integer that is equal to the integer portion of n. To round to an integer, use the Round() function with zero decimal places. Integers are promoted to real numbers as necessary, so there is no need for an IntToReal() function.

   Examples:   RealToInt (12.3) returns 12

      r2i (.73) returns 0

   RealToString (n), R2S (n)

   Description:   Changes n to the string representation of the real number.

   Arguments:   n – any real number

   Returned value:   A string representing the value of n

   Examples:   RealToString (12.3) returns "12.3"

      r2S (.73) returns “0.73”

   String (number)

   Description:   Converts number to a string.

   Arguments:   number – any numeric value

   Returned value:   a string equal to “number”

   Examples:   String (1234) returns “1234”

      String (1.756) returns “1.756”

   StringToInt (string), S2I (string)

   Description:   Changes string to an integer value.

   Arguments:   string – a string starting with a number

   Returned value:   An integer equal to the value of string, or zero if string begins with a non-numeric character

   Examples:   StringToInt (“123”) returns 123

      S2I (“.43”) returns 0

   StringToReal (string), S2R (string)

   Description:   Changes string to a real number.

   Arguments:   string – a string

   Returned value:   A real number equal to the value of string, or zero if string begins with a non-numeric character

   Examples:   StringToReal (“123.45”) returns 123.45

      S2I (“43”) returns 43.00

   Value (string)

   Description:   Converts string to a numeric value.

   Arguments:   string – a string starting with a number

   Returned value:   A value corresponding to the value of the number in string. Value() ignores all characters starting with the first alphabetic character. Therefore, a string starting with a non-numeric character evaluates to zero (0) and a string containing a number followed by letters evaluates to the number preceding the first letter

   Examples:   Value (“23347”) returns 23347

      Value (“455.77”) returns 455.77

      Value (“bridges”) returns 0

      Value (“123roads”) returns 123

      Value (“123roads456”) returns 123

Conditional Expressions

   if x then b

   Description:   If the condition x evaluates to true, then the value of the expression is b. If not, the value is null.

   Arguments:   x – a condition

      b – an expression that the command evaluates to if x is true

   Returned value:   The value of b or null, depending on whether x evaluates to true or false, respectively

   Examples:   (if population>100000 then 1)

      (if distance<5 then buffer)

   if x then b else c

   Description:   If the condition x evaluates to true, then the value of the expression is b. If not, the value is c.

   Arguments:   x – a condition

      b – an expression that the command evaluates to if x is true

      c – an expression that the command evaluates to if x is false

   Returned value:   The value of b or c, depending on whether x evaluates to true or false, respectively. b and c can be any expression, and their types need to match when used in a formula. x, b and c are all evaluated before a value is returned.

   Examples:   (if population>100000 then 1 else 0)

      (if distance<5 then buffer else no_buffer)

Standard System Formats and DateTime Specifiers

These Standard System Formats and DateTime specifiers can be used in the FormatDateTime() and ParseDateTime() functions. The Standard System Formats are according to Regional Settings system control panel. The Standard System Formats can be combined, e.g., @dT, which is the default format string. If fmt is null then ParseDateTime() will try to guess the format.

Standard System Format Description
@d Short date
@D Long date
@t Short time
@T Long time
Specifier Description
d The one- or two-digit day
dd The two-digit day; Single-digit day values are preceded by a 0
ddd The three-character day-of-week abbreviation
dddd The full day-of-week name
h The one- or two-digit hour in 12-hour format
hh The two-digit hour in 12-hour format; Single digit values are preceded by a 0
H The one- or two-digit hour in 24-hour format
HH The two-digit hour in 24-hour format; Single digit values are preceded by a 0
m The one- or two-digit minute
mm The two-digit minute; Single digit values are preceded by a 0
M The one- or two-digit month number
MM The two-digit month number; Single digit values are preceded by a 0
MMM The three-character month abbreviation
MMMM The full month name
s The one- or two-digit seconds
ss The two-digit seconds; Single digit values are preceded by a 0
t The one-letter A.M./P.M. abbreviation (e.g., A.M. is displayed as “A”)
tt The two-letter A.M./P.M. abbreviation (e.g., A.M. is displayed as “AM”)
y The one-digit year (e.g., 2001 is displayed as “1”)
yy The last two digits of the year (e.g., 2025 is displayed as “25”)
yyyy The full year (e.g., 2025 is displayed as “2025”)

 

 

©2026 Caliper Corporation