Expressions.expr-primary-location

Location string, used to define a location using latitude and longitude within a query.

LOCATION <location string>

Format

LOCATION { 'Location string' | ? | ( Location expression ) }

The Location string format is defined as follows:

Latitude, Longitude [, Accuracy] [ALT Altitude [, Altitude-Accuracy]] [DIR Heading, Speed] [TS yyyy-MM-dd [HH:mm:ss.SSS]]

where components (see Accuracy and Altitude) in [ ] are optional.

The following are examples of the how the components maybe combined within the Location string:

Latitude, Longitude

Latitude, Longitude [, Accuracy]

Latitude, Longitude [ALT Altitude]

Latitude, Longitude [ALT Altitude [, Altitude Accuracy]]

Latitude, Longitude [DIR Heading, Speed]

Latitude, Longitude [TS yyyy-MM-dd]

Latitude, Longitude [TS yyyy-MM-dd [HH:mm:ss.SSS]]

Latitude, Longitude [, Accuracy] [ALT Altitude [, Altitude Accuracy]] [DIR Heading, Speed] [TS yyyy-MM-dd [HH:mm:ss.SSS]]

The following table describes the required format for each component:

Type Format
Latitude, Longitude

Degrees as a decimal number, for example: 10.14563, 51.2368.

Accuracy (for Latitude & Longitude) Meters, (this data is normally provided by GPS systems), this allows you to refine a location query by the accuracy of the Latitude and Longitude data.
ALT Altitude Meters, above mean sea level.
Altitude-Accuracy Meters, allows you to define the accuracy of altitude position.
DIR Heading Heading in degrees clockwise from North.
Speed Meters per second, defines the speed along the heading
TS Timestamp yyy-MM-dd [HH:mm:ss.SSS]

All numeric location / region components in location strings use the English decimal point (a dot).

Remarks

Location values are defined using the LOCATION keyword followed by a Location value.

The Location value can be one of the following:

Comparison operators IN, NULLIF and CAST functions can be used with LOCATION literals and location database fields.

CAST supports LOCATION AS STRING and STRING AS LOCATION (string containing the standard location format).

Comparison operators can compare LOCATION with LOCATION, LOCATION with STRING and vice versa.

Example:

The following example illustrates the use of the LOCATION literal to list the distance (in kilometers) between a set of objects and a specified location. Only objects whose GEOPOSITION is less than Latitude 51 and Longitude 0 are included.

SELECT

NAME, GISLOCATION->GEOPOSITION, DISTANCE( LOCATION '51.476852,0' TO GISLOCATION->GEOPOSITION ) / 1000.0 AS "Distance In Km"

FROM

CDBOBJECT

WHERE

GISLOCATION->GEOPOSITION IS NOT NULL AND GISLOCATION->GEOPOSITION < '51,0'

 

This produces a list similar to that shown below:

Row Name GISLOCATION->GEOPOSITION Distance In Km
0 Direct Outstation Set 25, 0 2944.0916159
1 Analog Input Point 03 35, 0 1832.1423494
2 Analog Input Point 01 30, 0 2388.1169826
3 Analog Input Point 02 32, 0 2165.7271294

Also see:

DistanceFunctions.Distance Function


Disclaimer

Geo SCADA Expert 2020