| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 | [role="xpack"][[ml-geo-functions]]=== Geographic functionsThe geographic functions detect anomalies in the geographic location of theinput data.The {ml-features} include the following geographic function: `lat_long`.NOTE: You cannot create forecasts for {anomaly-jobs} that contain geographicfunctions. You also cannot add rules with conditions to detectors that usegeographic functions. [float][[ml-lat-long]]==== Lat_longThe `lat_long` function detects anomalies in the geographic location of theinput data.This function supports the following properties:* `field_name` (required)* `by_field_name` (optional)* `over_field_name` (optional)* `partition_field_name` (optional)For more information about those properties,see {ref}/ml-job-resource.html#ml-detectorconfig[Detector configuration objects]..Example 1: Analyzing transactions with the lat_long function[source,console]--------------------------------------------------PUT _ml/anomaly_detectors/example1{  "analysis_config": {    "detectors": [{      "function" : "lat_long",      "field_name" : "transactionCoordinates",      "by_field_name" : "creditCardNumber"    }]  },  "data_description": {    "time_field":"timestamp",    "time_format": "epoch_ms"  }}--------------------------------------------------// TEST[skip:needs-licence]If you use this `lat_long` function in a detector in your {anomaly-job}, itdetects anomalies where the geographic location of a credit card transaction isunusual for a particular customer’s credit card. An anomaly might indicate fraud.IMPORTANT: The `field_name` that you supply must be a single string that containstwo comma-separated numbers of the form `latitude,longitude`, a `geo_point` field,a `geo_shape` field that contains point values, or a `geo_centroid` aggregation.The `latitude` and `longitude` must be in the range -180 to 180 and represent apoint on the surface of the Earth.For example, JSON data might contain the following transaction coordinates:[source,js]--------------------------------------------------{  "time": 1460464275,  "transactionCoordinates": "40.7,-74.0",  "creditCardNumber": "1234123412341234"}--------------------------------------------------// NOTCONSOLEIn {es}, location data is likely to be stored in `geo_point` fields. For moreinformation, see {ref}/geo-point.html[Geo-point datatype]. This data type issupported natively in {ml-features}. Specifically, {dfeed} when pulling data froma `geo_point` field, will transform the data into the appropriate `lat,lon` stringformat before sending to the {anomaly-job}.For more information, see <<ml-configuring-transform>>.
 |