Spatial Functions


Most of the spatial functions are used to transform data so that it can be used to set up map charts in Spotfire. If the map information is included in a shapefile or GeoJSON file, none of this is necessary. However, if you have geographic information in some other type of BLOB column containing WKB (Well-Known Binary) data, then this information needs to be extracted into seven different columns: Geometry, XMax, XMin, YMax, YMin, XCenter and YCenter. The Geometry column is the original, binary column.

The bounding box for a geometry is called the envelope. It is specified by the four coordinates XMax, XMin, YMax and YMin. XCenter and YCenter specifies the center of the geometry. These coordinate columns can be calculated from the binary WKB column using the spatial functions with the binary WKB column as an argument. In order for the map chart to identify these columns they must also have the required property values (same as the column names listed above) set on the mapchart.columntypeid property. This is automatically done when the spatial functions below are applied.

See also Configuration of Geographical Data for Map Charts.

Function

Description

GreatCircleDistance(Arg1, Arg2, Arg3, Arg4)

Returns the shortest distance between two points, calculated on the surface of a unit sphere. The arguments are the latitude and longitude of the coordinates (lat1, long1, lat2, long2), expressed in degrees.

To obtain the result in a certain unit, multiply the result from the GreatCircleDistance method with the radius of the interesting sphere in the desired unit. For example, the radius of the earth is approximately 6371 km (3959 miles), so the first two examples below will give the distance between two cities expressed in kilometers and the third example gives the distance in miles.

Examples:

6371*GreatCircleDistance(57.717829, 11.990509, 42.355145, -71.057892)

6371*GreatCircleDistance([Latitude], [Longitude], 42.355145, -71.057892)

3959*GreatCircleDistance(57.717829, 11.990509, 42.355145, -71.057892)

WKBEnvelopeXCenter(Arg1)

Calculates the X center of the geometry envelope and sets the XCenter value on the mapchart.columntypeid property. The argument is a binary WKB column.

Example:

WKBEnvelopeXCenter([WKB])

WKBEnvelopeXMin(Arg1)

Calculates the X min of the geometry envelope and sets the XMin value on the mapchart.columntypeid property. The argument is a binary WKB column.

Example:

WKBEnvelopeXMin([WKB])

WKBEnvelopeXMax(Arg1)

Calculates the X max of the geometry envelope and sets the XMax value on the mapchart.columntypeid property. The argument is a binary WKB column.

Example:

WKBEnvelopeXMax([WKB])

WKBEnvelopeYCenter(Arg1)

Calculates the Y center of the geometry envelope and sets the YCenter value on the mapchart.columntypeid property. The argument is a binary WKB column.

Example:

WKBEnvelopeYCenter([WKB])

WKBEnvelopeYMin(Arg1)

Calculates the Y min of the geometry envelope and sets the YMin value on the mapchart.columntypeid property. The argument is a binary WKB column.

Example:

WKBEnvelopeYMin([WKB])

WKBEnvelopeYMax(Arg1)

Calculates the Y max of the geometry envelope and sets the YMax value on the mapchart.columntypeid property. The argument is a binary WKB column.

Example:

WKBEnvelopeYMax([WKB])

See also:

Binning functions

Conversion functions

Date and Time functions

Keywords

Logical functions

Math functions

OVER functions

Property functions

Ranking functions

Statistical functions

Text functions