0

I want to use Stream Analytics geospatial functions by using the latitude/longitude data (sent via Azure IoTHub) and a target latitude/longitude or polygon data (from reference input).

I know we can join stream and reference inputs in a query but is it possible to implement a solution we do not have any data to join between stream and reference inputs and still calculate e.g. the distance between points using ST_DISTANCE?

The sample reference input data:

"points":[
{
    "point": {
    "type" : "Point",
    "coordinates" : [0.0, 10.0] } 
},
{
    "point": {
    "type" : "Point",
    "coordinates" : [0.0, 0.0] }
},
{
    "point": {
    "type" : "Point",
    "coordinates" : [0.0, -5.0] }
}]

The data above will have more points, so manual entry of the points in the query will not be a good solution.

I expect the output to contain the points compared and their distance.

dansc
  • 219
  • 3
  • 12
  • Could you please provide some sample input data and your desired output? You mean you 're using `ST_DISTANCE` method? – Jay Gong Jan 11 '19 at 08:48
  • Thank you I edited the question – dansc Jan 11 '19 at 09:56
  • Do you mean to calculate the distance between a point (from incoming data stream) against a list of all points present in the reference data? This sounds like a cross join which is not supported in Stream Analytics today. – Sid Ramadoss Jan 14 '19 at 22:32

1 Answers1

1

After playing with the SQL query, I found out that actually CROSS JOIN is available in Stream Analytics but not in the documentation. So using something like:

SELECT ST_DISTANCE(CreatePoint(input.Lat, input.Lon), CreatePoint(ref.Lat, ref.Lon)) 
INTO output FROM inputStream input 
CROSS JOIN reference ref

works.

dansc
  • 219
  • 3
  • 12