Click or drag to resize
Location data type
Print this page

The data type Location identifies a location as degrees latitude, degrees longitude. When you work with columns that have the Location data type, you have the option to either work with the full location as a string or with the individual Lat and Lon subfields that make up the location.

Tip Tip

When you insert lat/lon values, TDE puts the inserted values on a grid that has an accuracy to 13 decimal places. If you need to validate location data by comparing it with what you are retrieving from TDE, be sure to account for the greater accuracy: use a range test, or round off both values to the same decimal place.

Location input

Within input templates, when you provide the location as a string, the lat and lon components of the location are automatically converted to the appropriate subfield.

Examples of location string inputs
"33.94251,-118.41971"
"30.3976,-97.72958"

You can also specify location inputs as a JSON or XPATH object

Example of a JSON location input
[
   {
     "Location": {
            "Lat": 33.94251,
            "Lon": -118.41971
           }
   }
]
Example of an XPATH location input
<?xml version="1.0" encoding="utf-8"?>
<Location>
   <Lat>33.94251</Lat>
   <Lon>-118.41971</Lon>
 </Location>
Subfields

Instead of inputting or outputting the location as a string, you also have the option to work with the individual subfields that make up a location (for example, BaseLocation.Lat). For more information about working with subfields, see Accessing subfields.

The Location data type contains the following subfields:

SubfieldData TypeDescription
LatAngleThe latitude for the location. It must be between -90 and 90 degrees. If this value is 0, then the value of Lon must be non-zero.
LonAngleThe longitude for the location. It must be between -180 and 180 degrees. If this value is 0, then the value of Lat must be non-zero.
Field length

This data type is stored as 13 digits in the database, to an accuracy of 1 meter.

JavaScript conversion

When you use the optional [Script] section to insert your own JavaScript functions, Location data maps to a LatLon object:

Constructor
JavaScript
new Location({Lat: 33.584223, Lon: -117.731500})
Available fields for (get,set)

You can access these address elements as fields:

  • Lat (get, set)

  • Lon (get, set)