DIST2NEAREST(LT, LN, TLT, TLN)
- 1 Minute to read
- Print
- DarkLight
- PDF
DIST2NEAREST(LT, LN, TLT, TLN)
- 1 Minute to read
- Print
- DarkLight
- PDF
Article summary
Did you find this summary helpful?
Thank you for your feedback
Geo: DIST2NEAREST (LT, LN, TLT, TLN)
Returns the distance, in meters, from (LT,LN) to the nearest location, as found in lookup fields (TLT, TLN)
Purpose
Use this function to:
- Calculate the distance between a geographical location and its nearest location in a lookup table
- Find the distance between a geographical point and another location, where the location search has a minimum range to search above
Return Value
Property | Value |
---|---|
FieldType | Integer |
FieldSize | Continuous |
DataType | Continuous |
DataSize | Integer |
Example Return Value: 0 to N, where:
- N is the number of meters between points (LT, LN) and points (TLT, TLN)
- N is greater than the value provided by limiter
Parameters
Parameter | JSON | Description |
---|---|---|
Table | “targetTable”: “MyTableName” | The target table on which the new field will be created |
Filter | “dataset”: {DataSet_JSON} | Optional. If a filter is applied, records not in the filter DataSet will be returned as null. |
Function | "function":"geo" | Geo |
Geo Function | "p1": "DIST2NEAREST(LT,LN,TLT,TLN)" | DIST2NEAREST(LT,LN,TLT,TLN) |
LT | “p2”: "lat" | Required. The field on the targetTable containing the latitude value. Supports:
|
LN | “p3”: "lon" | Required. The field on the targetTable containing the longitude value Supports:
|
TLT | “p4”: "lat" | Required. The fully qualified column on the lookup table that contains latitude. Can be on a lookup table or on the targetTable. Supports:
|
TLN | “p5”:"lon" | Required. The fully qualified column on the lookup table that contains longitude. Can be on a lookup table or on the targetTable. Supports:
|
Limiter | “limiter”:"#1" | Optional. The column or value that provides a minimum threshold - values below the threshold will be excluded. Note that fixed values represent meters. Supports:
|
JSON Sample
{
"method": "BuildBakedField",
"project": "Matching1",
"targetTable": "worldcities",
"overwrite": true,
"name": "Distance To Nearest City",
"function": "geo",
"p1": "DIST2NEAREST(LT,LN,TLT,TLN)",
"p2": "lat",
"p3": "lng",
"p4": "worldcities.lat",
"p5": "worldcities.lng",
"limiter": "#1"
}
Usage Notes
DIST2NEAREST returns an integer value representing the number of meters between the 2 points. Nearest points which are below the threshold specified by "limiter" will be excluded.
For more information on using Geo functions, see QQ - How do I get the name of the nearest city from a table of Geo Data?
See Also:
Example
Example | Details |
---|---|
Description | Find distance to nearest city in meters |
Input |
|
Sample |
Was this article helpful?