XPath/XQuery Functions: Geolocation

www.altova.com Expand/Collapse All Print this Topic Previous Page Up One Level Next page

Home >  Appendices > Engine information > XSLT and XPath/XQuery Functions > Altova Extension Functions >

XPath/XQuery Functions: Geolocation

The following geolocation XPath/XQuery extension functions are supported in the current version of MapForce and can be used in (i) XPath expressions in an XSLT context, or (ii) XQuery expressions in an XQuery document.

 

Note about naming of functions and language applicability

Altova extension functions can be used in XPath/XQuery expressions. They provide additional functionality to the functionality that is available in the standard library of XPath, XQuery, and XSLT functions. Altova extension functions are in the Altova extension functions namespace, http://www.altova.com/xslt-extensions, and are indicated in this section with the prefix altova:, which is assumed to be bound to this namespace. Note that, in future versions of your product, support for a function might be discontinued or the behavior of individual functions might change. Consult the documentation of future releases for information about support for Altova extension functions in that release.

 

XPath functions (used in XPath expressions in XSLT):

XP1 XP2 XP3.1

XSLT functions (used in XPath expressions in XSLT):

Xslt1 XSLT2 XSLT3

XQuery functions (used in XQuery expressions in XQuery):

XQ1 XQ3.1

 

 

Click to expand/collapseformat-geolocation [altova:]

altova:format-geolocation(Latitude as xs:decimalLongitude as xs:decimalGeolocationOutputStringFormat as xs:integer) as xs:string     XP3.1 XQ3.1

Takes the latitude and longitude as the first two arguments, and outputs the geolocation as a string. The third argument, GeolocationOutputStringFormat, is the format of the geolocation output string; it uses integer values from 1 to 4 to identify the output string format (see 'Geolocation output string formats' below). Latitude values range from +90 to -90 (N to S). Longitude values range from +180 to -180 (E to W).

 

Note: The image-exif-data function and the Exif metadata's attributes can be used to supply the input strings.

 

altova:format-geolocation(33.33, -22.22, 4) returns the xs:string "33.33 -22.22"
altova:format-geolocation(33.33, -22.22, 2) returns the xs:string "33.33N 22.22W"
altova:format-geolocation(-33.33, 22.22, 2) returns the xs:string "33.33S 22.22E"
altova:format-geolocation(33.33, -22.22, 1) returns the xs:string "33°19'48.00"S 22°13'12.00"E"

 

The supplied latitude and longitude is formatted in one of the output formats given below. The desired format is identified by its integer ID (1 to 4). Latitude values range from +90 to -90 (N to S). Longitude values range from +180 to -180 (E to W).

 

1

Degrees, minutes, decimal seconds, with suffixed orientation (N/S, E/W)
D°M'S.SS"N/S  D°M'S.SS"E/W

Example: 33°55'11.11"N  22°44'66.66"W

 

2

Decimal degrees, with suffixed orientation (N/SE/W)
D.DDN/S  D.DDE/W

Example: 33.33N  22.22W

 

3

Degrees, minutes, decimal seconds, with prefixed sign (+/-); plus sign for (N/E) is optional 
+/-D°M'S.SS"  +/-D°M'S.SS"

Example: 33°55'11.11"  -22°44'66.66"

 

4

Decimal degrees, with prefixed sign (+/-); plus sign for (N/E) is optional 
+/-D.DD  +/-D.DD

Example: 33.33 -22.22

 

 

The Altova XPath/XQuery Engine generates the custom attribute Geolocation from standard Exif metadata tags. Geolocation is a concatenation of four Exif tags: GPSLatitude, GPSLatitudeRef, GPSLongitude, GPSLongitudeRef, with units added (see table below).

 

GPSLatitude

GPSLatitudeRef

GPSLongitude

GPSLongitudeRef

Geolocation

33 51 21.91

S

151 13 11.73

E

33°51'21.91"S 151°13'11.73"E

 

 

 

 

Click to expand/collapseparse-geolocation [altova:]

altova:parse-geolocation(GeolocationInputString as xs:string) as xs:decimal+     XP3.1 XQ3.1

Parses the supplied GeolocationInputString argument and returns the geolocation's latitude and longitude (in that order) as a sequence two xs:decimal items. The formats in which the geolocation input string can be supplied are listed below.

 

Note: The image-exif-data function and the Exif metadata's @Geolocation attribute can be used to supply the geolocation input string (see example below).

 

altova:parse-geolocation("33.33  -22.22") returns the sequence of two xs:decimals (33.33, 22.22)
altova:parse-geolocation("48°51'29.6""N  24°17'40.2""") returns the sequence of two xs:decimals (48.8582222222222, 24.2945)
altova:parse-geolocation('48°51''29.6"N  24°17''40.2"') returns the sequence of two xs:decimals (48.8582222222222, 24.2945)
altova:parse-geolocation( image-exif-data(//MyImages/Image20141130.01)/@Geolocation ) returns a sequence of two xs:decimals

 

The geolocation input string must contain latitude and longitude (in that order) separated by whitespace. Each can be in any of the following formats. Combinations are allowed. So latitude can be in one format and longitude can be in another. Latitude values range from +90 to -90 (N to S). Longitude values range from +180 to -180 (E to W).

 

Note: If single quotes or double quotes are used to delimit the input string argument, this will create a mismatch with the single quotes or double quotes that are used, respectively, to indicate minute-values and second-values. In such cases, the quotes that are used for indicating minute-values and second-values must be escaped by doubling them. In the examples in this section, quotes used to delimit the input string are highlighted in yellow (") while unit indicators that are escaped are highlighted in blue ("").

 

Degrees, minutes, decimal seconds, with suffixed orientation (N/SW/E)
D°M'S.SS"N/S  D°M'S.SS"W/E

Example: 33°55'11.11"N  22°44'55.25"W

 

Degrees, minutes, decimal seconds, with prefixed sign (+/-); the plus sign for (N/W) is optional 
+/-D°M'S.SS"  +/-D°M'S.SS"

Example: 33°55'11.11"  -22°44'55.25"

 

Degrees, decimal minutes, with suffixed orientation (N/SW/E)
D°M.MM'N/S  D°M.MM'W/E

Example: 33°55.55'N  22°44.44'W

 

Degrees, decimal minutes, with prefixed sign (+/-); the plus sign for (N/W) is optional 
+/-D°M.MM'  +/-D°M.MM'

Example: +33°55.55'  -22°44.44'

 

Decimal degrees, with suffixed orientation (N/SW/E)
D.DDN/S  D.DDW/E

Example: 33.33N  22.22W

 

Decimal degrees, with prefixed sign (+/-); the plus sign for (N/W) is optional 
+/-D.DD  +/-D.DD

Example: 33.33  -22.22

 

Examples of format-combinations:

33.33N  -22°44'55.25"

33.33  22°44'55.25"W

33.33  22.45

The Altova XPath/XQuery Engine generates the custom attribute Geolocation from standard Exif metadata tags. Geolocation is a concatenation of four Exif tags: GPSLatitude, GPSLatitudeRef, GPSLongitude, GPSLongitudeRef, with units added (see table below).

 

GPSLatitude

GPSLatitudeRef

GPSLongitude

GPSLongitudeRef

Geolocation

33 51 21.91

S

151 13 11.73

E

33°51'21.91"S 151°13'11.73"E

 

 


Click to expand/collapsegeolocation-distance-km [altova:]

altova:geolocation-distance-km(GeolocationInputString-1 as xs:stringGeolocationInputString-2 as xs:string) as xs:decimal     XP3.1 XQ3.1

Calculates the distance between two geolocations in kilometers. The formats in which the geolocation input string can be supplied are listed below. Latitude values range from +90 to -90 (N to S). Longitude values range from +180 to -180 (E to W).

 

Note: The image-exif-data function and the Exif metadata's @Geolocation attribute can be used to supply geolocation input strings.

 

altova:geolocation-distance-km("33.33  -22.22", "48°51'29.6""N  24°17'40.2""") returns the xs:decimal 4183.08132372392

 

The geolocation input string must contain latitude and longitude (in that order) separated by whitespace. Each can be in any of the following formats. Combinations are allowed. So latitude can be in one format and longitude can be in another. Latitude values range from +90 to -90 (N to S). Longitude values range from +180 to -180 (E to W).

 

Note: If single quotes or double quotes are used to delimit the input string argument, this will create a mismatch with the single quotes or double quotes that are used, respectively, to indicate minute-values and second-values. In such cases, the quotes that are used for indicating minute-values and second-values must be escaped by doubling them. In the examples in this section, quotes used to delimit the input string are highlighted in yellow (") while unit indicators that are escaped are highlighted in blue ("").

 

Degrees, minutes, decimal seconds, with suffixed orientation (N/SW/E)
D°M'S.SS"N/S  D°M'S.SS"W/E

Example: 33°55'11.11"N  22°44'55.25"W

 

Degrees, minutes, decimal seconds, with prefixed sign (+/-); the plus sign for (N/W) is optional 
+/-D°M'S.SS"  +/-D°M'S.SS"

Example: 33°55'11.11"  -22°44'55.25"

 

Degrees, decimal minutes, with suffixed orientation (N/SW/E)
D°M.MM'N/S  D°M.MM'W/E

Example: 33°55.55'N  22°44.44'W

 

Degrees, decimal minutes, with prefixed sign (+/-); the plus sign for (N/W) is optional 
+/-D°M.MM'  +/-D°M.MM'

Example: +33°55.55'  -22°44.44'

 

Decimal degrees, with suffixed orientation (N/SW/E)
D.DDN/S  D.DDW/E

Example: 33.33N  22.22W

 

Decimal degrees, with prefixed sign (+/-); the plus sign for (N/W) is optional 
+/-D.DD  +/-D.DD

Example: 33.33  -22.22

 

Examples of format-combinations:

33.33N  -22°44'55.25"

33.33  22°44'55.25"W

33.33  22.45

The Altova XPath/XQuery Engine generates the custom attribute Geolocation from standard Exif metadata tags. Geolocation is a concatenation of four Exif tags: GPSLatitude, GPSLatitudeRef, GPSLongitude, GPSLongitudeRef, with units added (see table below).

 

GPSLatitude

GPSLatitudeRef

GPSLongitude

GPSLongitudeRef

Geolocation

33 51 21.91

S

151 13 11.73

E

33°51'21.91"S 151°13'11.73"E

 

 

 

 

Click to expand/collapsegeolocation-distance-mi [altova:]

altova:geolocation-distance-mi(GeolocationInputString-1 as xs:stringGeolocationInputString-2 as xs:string) as xs:decimal     XP3.1 XQ3.1

Calculates the distance between two geolocations in miles. The formats in which a geolocation input string can be supplied are listed below. Latitude values range from +90 to -90 (N to S). Longitude values range from +180 to -180 (E to W).

 

Note: The image-exif-data function and the Exif metadata's @Geolocation attribute can be used to supply geolocation input strings.

 

altova:geolocation-distance-mi("33.33  -22.22", "48°51'29.6""N  24°17'40.2""") returns the xs:decimal 2599.40652340653

 

The geolocation input string must contain latitude and longitude (in that order) separated by whitespace. Each can be in any of the following formats. Combinations are allowed. So latitude can be in one format and longitude can be in another. Latitude values range from +90 to -90 (N to S). Longitude values range from +180 to -180 (E to W).

 

Note: If single quotes or double quotes are used to delimit the input string argument, this will create a mismatch with the single quotes or double quotes that are used, respectively, to indicate minute-values and second-values. In such cases, the quotes that are used for indicating minute-values and second-values must be escaped by doubling them. In the examples in this section, quotes used to delimit the input string are highlighted in yellow (") while unit indicators that are escaped are highlighted in blue ("").

 

Degrees, minutes, decimal seconds, with suffixed orientation (N/SW/E)
D°M'S.SS"N/S  D°M'S.SS"W/E

Example: 33°55'11.11"N  22°44'55.25"W

 

Degrees, minutes, decimal seconds, with prefixed sign (+/-); the plus sign for (N/W) is optional 
+/-D°M'S.SS"  +/-D°M'S.SS"

Example: 33°55'11.11"  -22°44'55.25"

 

Degrees, decimal minutes, with suffixed orientation (N/SW/E)
D°M.MM'N/S  D°M.MM'W/E

Example: 33°55.55'N  22°44.44'W

 

Degrees, decimal minutes, with prefixed sign (+/-); the plus sign for (N/W) is optional 
+/-D°M.MM'  +/-D°M.MM'

Example: +33°55.55'  -22°44.44'

 

Decimal degrees, with suffixed orientation (N/SW/E)
D.DDN/S  D.DDW/E

Example: 33.33N  22.22W

 

Decimal degrees, with prefixed sign (+/-); the plus sign for (N/W) is optional 
+/-D.DD  +/-D.DD

Example: 33.33  -22.22

 

Examples of format-combinations:

33.33N  -22°44'55.25"

33.33  22°44'55.25"W

33.33  22.45

The Altova XPath/XQuery Engine generates the custom attribute Geolocation from standard Exif metadata tags. Geolocation is a concatenation of four Exif tags: GPSLatitude, GPSLatitudeRef, GPSLongitude, GPSLongitudeRef, with units added (see table below).

 

GPSLatitude

GPSLatitudeRef

GPSLongitude

GPSLongitudeRef

Geolocation

33 51 21.91

S

151 13 11.73

E

33°51'21.91"S 151°13'11.73"E

 

 

 

 

Click to expand/collapsegeolocation-within-polygon [altova:]

altova:geolocation-within-polygon(Geolocation as xs:string, ((PolygonPoint as xs:string)+)) as xs:boolean     XP3.1 XQ3.1

Determines whether Geolocation (the first argument) is within the polygonal area described by the PolygonPoint arguments. If the PolygonPoint arguments do not form a closed figure (formed when the first point and the last point are the same), then the first point is implicitly added as the last point in order to close the figure. All the arguments (Geolocation and PolygonPoint+) are given by geolocation input strings (formats listed below). If the Geolocation argument is within the polygonal area, then the function returns true(); otherwise it returns false(). Latitude values range from +90 to -90 (N to S). Longitude values range from +180 to -180 (E to W).

 

Note: The image-exif-data function and the Exif metadata's @Geolocation attribute can be used to supply geolocation input strings.

 

altova:geolocation-within-polygon("33 -22", ("58 -32", "-78 -55", "48 24", "58 -32")) returns true()
altova:geolocation-within-polygon("33 -22", ("58 -32", "-78 -55", "48 24")) returns true()
altova:geolocation-within-polygon("33 -22", ("58 -32", "-78 -55", "48°51'29.6""N  24°17'40.2""")) returns true()

 

The geolocation input string must contain latitude and longitude (in that order) separated by whitespace. Each can be in any of the following formats. Combinations are allowed. So latitude can be in one format and longitude can be in another. Latitude values range from +90 to -90 (N to S). Longitude values range from +180 to -180 (E to W).

 

Note: If single quotes or double quotes are used to delimit the input string argument, this will create a mismatch with the single quotes or double quotes that are used, respectively, to indicate minute-values and second-values. In such cases, the quotes that are used for indicating minute-values and second-values must be escaped by doubling them. In the examples in this section, quotes used to delimit the input string are highlighted in yellow (") while unit indicators that are escaped are highlighted in blue ("").

 

Degrees, minutes, decimal seconds, with suffixed orientation (N/SW/E)
D°M'S.SS"N/S  D°M'S.SS"W/E

Example: 33°55'11.11"N  22°44'55.25"W

 

Degrees, minutes, decimal seconds, with prefixed sign (+/-); the plus sign for (N/W) is optional 
+/-D°M'S.SS"  +/-D°M'S.SS"

Example: 33°55'11.11"  -22°44'55.25"

 

Degrees, decimal minutes, with suffixed orientation (N/SW/E)
D°M.MM'N/S  D°M.MM'W/E

Example: 33°55.55'N  22°44.44'W

 

Degrees, decimal minutes, with prefixed sign (+/-); the plus sign for (N/W) is optional 
+/-D°M.MM'  +/-D°M.MM'

Example: +33°55.55'  -22°44.44'

 

Decimal degrees, with suffixed orientation (N/SW/E)
D.DDN/S  D.DDW/E

Example: 33.33N  22.22W

 

Decimal degrees, with prefixed sign (+/-); the plus sign for (N/W) is optional 
+/-D.DD  +/-D.DD

Example: 33.33  -22.22

 

Examples of format-combinations:

33.33N  -22°44'55.25"

33.33  22°44'55.25"W

33.33  22.45

The Altova XPath/XQuery Engine generates the custom attribute Geolocation from standard Exif metadata tags. Geolocation is a concatenation of four Exif tags: GPSLatitude, GPSLatitudeRef, GPSLongitude, GPSLongitudeRef, with units added (see table below).

 

GPSLatitude

GPSLatitudeRef

GPSLongitude

GPSLongitudeRef

Geolocation

33 51 21.91

S

151 13 11.73

E

33°51'21.91"S 151°13'11.73"E

 

 

 

 

Click to expand/collapsegeolocation-within-rectangle [altova:]

altova:geolocation-within-rectangle(Geolocation as xs:stringRectCorner-1 as xs:stringRectCorner-2 as xs:string) as xs:boolean     XP3.1 XQ3.1

Determines whether Geolocation (the first argument) is within the rectangle defined by the second and third arguments, RectCorner-1 and RectCorner-2, which specify opposite corners of the rectangle. All the arguments (Geolocation, RectCorner-1 and RectCorner-2) are given by geolocation input strings (formats listed below). If the Geolocation argument is within the rectangle, then the function returns true(); otherwise it returns false(). Latitude values range from +90 to -90 (N to S). Longitude values range from +180 to -180 (E to W).

 

Note: The image-exif-data function and the Exif metadata's @Geolocation attribute can be used to supply geolocation input strings.

 

altova:geolocation-within-rectangle("33 -22", "58 -32", "-48 24") returns true()
altova:geolocation-within-rectangle("33 -22", "58 -32", "48 24") returns false()
altova:geolocation-within-rectangle("33 -22", "58 -32", "48°51'29.6""S  24°17'40.2""") returns true()

 

The geolocation input string must contain latitude and longitude (in that order) separated by whitespace. Each can be in any of the following formats. Combinations are allowed. So latitude can be in one format and longitude can be in another. Latitude values range from +90 to -90 (N to S). Longitude values range from +180 to -180 (E to W).

 

Note: If single quotes or double quotes are used to delimit the input string argument, this will create a mismatch with the single quotes or double quotes that are used, respectively, to indicate minute-values and second-values. In such cases, the quotes that are used for indicating minute-values and second-values must be escaped by doubling them. In the examples in this section, quotes used to delimit the input string are highlighted in yellow (") while unit indicators that are escaped are highlighted in blue ("").

 

Degrees, minutes, decimal seconds, with suffixed orientation (N/SW/E)
D°M'S.SS"N/S  D°M'S.SS"W/E

Example: 33°55'11.11"N  22°44'55.25"W

 

Degrees, minutes, decimal seconds, with prefixed sign (+/-); the plus sign for (N/W) is optional 
+/-D°M'S.SS"  +/-D°M'S.SS"

Example: 33°55'11.11"  -22°44'55.25"

 

Degrees, decimal minutes, with suffixed orientation (N/SW/E)
D°M.MM'N/S  D°M.MM'W/E

Example: 33°55.55'N  22°44.44'W

 

Degrees, decimal minutes, with prefixed sign (+/-); the plus sign for (N/W) is optional 
+/-D°M.MM'  +/-D°M.MM'

Example: +33°55.55'  -22°44.44'

 

Decimal degrees, with suffixed orientation (N/SW/E)
D.DDN/S  D.DDW/E

Example: 33.33N  22.22W

 

Decimal degrees, with prefixed sign (+/-); the plus sign for (N/W) is optional 
+/-D.DD  +/-D.DD

Example: 33.33  -22.22

 

Examples of format-combinations:

33.33N  -22°44'55.25"

33.33  22°44'55.25"W

33.33  22.45

The Altova XPath/XQuery Engine generates the custom attribute Geolocation from standard Exif metadata tags. Geolocation is a concatenation of four Exif tags: GPSLatitude, GPSLatitudeRef, GPSLongitude, GPSLongitudeRef, with units added (see table below).

 

GPSLatitude

GPSLatitudeRef

GPSLongitude

GPSLongitudeRef

Geolocation

33 51 21.91

S

151 13 11.73

E

33°51'21.91"S 151°13'11.73"E

 

 

 

 

[ Top ]

 


© 2019 Altova GmbH