Location data type |
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 |
---|
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. |
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.
"33.94251,-118.41971" "30.3976,-97.72958"
You can also specify location inputs as a JSON or XPATH object
[ { "Location": { "Lat": 33.94251, "Lon": -118.41971 } } ]
<?xml version="1.0" encoding="utf-8"?> <Location> <Lat>33.94251</Lat> <Lon>-118.41971</Lon> </Location>
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:
Subfield | Data Type | Description |
---|---|---|
Lat | Angle | The 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. |
Lon | Angle | The 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. |
This data type is stored as 13 digits in the database, to an accuracy of 1 meter.
When you use the optional [Script] section to insert your own JavaScript functions, Location data maps to a LatLon object:
new Location({Lat: 33.584223, Lon: -117.731500})
You can access these address elements as fields:
Lat (get, set)
Lon (get, set)