# MI_Distance

## Description

Returns the geographic distance between two geometry objects.

## Syntax

MI_Distance ( geom1, geom2, unit, calculationType )

## Arguments

`geom1` is an expression which returns a geometry,

`geom2` is an expression which returns a geometry,

`unit` is a linear unit specification, and

`calculationType` is a string that indicates whether to perform a Spherical or Cartesian calculation. There is no default.

## Example

Returns the distance between the specified geomety and each countries.

```
select MI_Distance(MI_Box(-20,-20,20,20,'epsg:4326'),Obj,'mi','Spherical') as distance from "/Samples/NamedTables/WorldTable" where country in ('Canada','Vietnam','Brazil','China','Japan')
```

## Remarks

Calculates the distance between two geometries. The value returned is a double and represents a value in the units specified by the `units` argument.

Valid values for `unit` are the following distance units:

Value | Description |
---|---|

mi | miles |

km | kilometers |

in | inches |

ft | feet |

yd | yards |

mm | millimeters |

cm | centimeters |

m | meters |

survey ft | US Survey feet |

nmi | nautical miles |

twip | twips |

pt | points |

pica | picas |

degree | degrees |

li | links |

ch | chains |

rd | rods |