IBM Streams 4.2

Java Native Functions: com.ibm.streams.geospatial.ext

This page documents native functions that can be invoked from SPL, including the SPL interfaces that can be used to invoke each of the native functions.

Functions

<string T> public T base32GeohashToBinary(T geohash)

Converts a geohash in base32 format to a binary string. In case of an exception, the empty string will be returned and the exception logged.

<string T> public T binaryGeohashToBase32(T geohash)

Converts a geohash in binary format to a base32 string. In case of an exception, the empty string will be returned and the exception logged.

<string T> public T containingGeohash(T geom, float64 boxSize)

Provides a utility method to do spatial aggregation on point geometry data, where the input geometry is expected to be a point (in WGS84 coordinates) in WKT format and a boxSize in meters. Refer to the 'Geohashes' section in the introductory documentation for information on box sizes and geohashes. The output is a bit-encoding of geohash represented as a binary string that can be used to group rows together, which effectively provides spatial aggregation at the size of boxSize.In case of an exception, the empty string will be returned and the exception logged.

<string T> public T destinationPoint(T point, float64 azimuth, float64 distance)

Computes the destination point given a point, the heading/azimuth, and the distance in meters, the input point is in WKT format with WGS84 coordinates, the output point is in WKT WGS84 format. In case of an exception,the empty string will be returned and the exception logged.

<string T> public T geohashDecode(T geohash)

Decodes a given geohash to its corresponding geometry in WKT format. If the geohash is of full 128 bit length, then it gets decoded into a point, else a bounding box is returned. In case of an exception, the empty string will be returned and the exception logged.

<string T> public T geohashDistanceEncode(T geom, float64 distance)

Encodes the input geometry as a bit representation geohash. This function takes another parameter - distance, which defines the 'buffer' zone for the given input geometry. Hence, the encoding will ensure that the set of geohash strings will cover the geometry within a distance specified by the second parameter.In case of an exception, the empty string will be returned and the exception logged. More information on geohashes can be found in the 'Geohashes' section in the introductory documentation for the Geospatial toolkit

<string T> public T geohashEncode(T geom)

Encodes the provided geometry as a geohash in bit representation. The 'Geohashes' section in the introductory documentation for the Geospatial toolkit has more information on geohashes and their use within the toolkit. The input geometry is in WKT format and the output is a binary string. This encoding can be used for indexing and join queries. In case of an exception, the empty string will be returned and the exception logged.

<string T> public T geohashStringDecode(T geohash)

Decodes a given base 32 encoded geohash to its corresponding point geometry in WKT format. In case of an exception, the empty string will be returned and the exception logged.

<string T> public T geohashStringEncode(T geom)

Encodes the provided point as a base 32 encoded string. The 'Geohashes' section in the introductory documentation for the Geospatial toolkit has more information on geohashes and their use within the toolkit. The input geometry is in WKT format and must be a point.In case of an exception, the empty string will be returned and the exception logged.

<string T> public float64 getLatitude(T point)

Extract latitude from WKT point geometry

<string T> public float64 getLongitude(T point)

Extract longitude from WKT point geometry

public rstring lineSegment(float64 startLongitude, float64 startLatitude, float64 endLongitude, float64 endLatitude)

Constructs a line segment from four doubles, the order is specified as 'startlongitude, startlatitude, endlongitude, endlatitude' and the output is a WKT formatted geometry

<string T> public T nearestPoint(T lineString, T point)

Finds the nearest point on a linestring from a given point, where both geometries are specified in WKT format and WGS84 coordinates.

<string T> public T orientedPolygon(T polyStr)

Constructs a polygon that has its orientation specified, the polygon is a simple polygon and specified as a string with comma separated longitude, latitude values (in WGS84 decimal degrees). The input's orientation is the orientation of the polygon. The polygon construction follows the left-handed rule. The output is a geometry in WKT format.

public rstring point(float64 longitude, float64 latitude)

Constructs a point geometry from a longitude and a latitude, both specified in decimal degrees in WGS84 Datum. The output is WKT formatted point geometry.

<string T> public T polygon(T polyStr)

Constructs a polygon from a String representation, where the polygon is a simple polygon (without any holes) and is specified as follows: 'longitude_1, latitude_1, longitude_2, latitude_2, ... , longitude_n, latitude_n', where n is the number of points. This constructor will re-orient the polygon so that it always constructs the 'smaller' polygon. The output format is a WKT geometry

public list<int64> timeBoxesForPeriod(int64 start, int64 end, int32 timeBoxSize)

Computes the discrete time period covered by the start and end. It returns the start time of all the interval of size timeBoxsize seconds between the start and end. Start and end times are in milliseconds and timeBoxSize is in seconds.

public list<uint64> timeBoxesForPeriod(uint64 start, uint64 end, uint32 timeBoxSize)

Computes the discrete time period covered by the start and end. It returns the start time of all the interval of size timeBoxsize seconds between the start and end. Start and end times are in milliseconds and timeBoxSize is in seconds.

<string T> public boolean withinDistance(T geom1, T geom2, float64 distance)

Returns true if the first geometry and the second geometry are within the specified distance in meters. In case of an exception, false will be returned and the exception logged.