We recently announced the general availability of Geospatial Functions in Azure Stream Analytics to enable real-time analytics on streaming geospatial data. This will make it possible to realize scenarios such as fleet monitoring, asset tracking, geofencing, phone tracking across cell sites, connected manufacturing, ridesharing solutions, etc. with production grade quality with a few lines of code.

The connected car landscape and the turning of the automobile into a real-time data exhaust opens new avenues of business for automation, and post-sale monetization opportunities in industries such as insurance and content providers. NASCAR has been a pioneer in using geospatial capabilities in Azure Stream Analytics.

“We use real-time geospatial analytics with Azure Stream Analytics for analyzing race telemetry during and after the race,” said NASCAR’s Managing Director of Technology Development, Betsy Grider.

The new capabilities provide native functions that can be used in Azure Stream Analytics to compute geospatial operations such as the identification of geospatial data as points, lines, and polygons, computation of overlap between polygons, intersections between paths, etc. The ability to join multiple streams with geospatial data can be used to answer complex questions on streaming data.
We’ve adopted the GeoJSON standard for dealing with geospatial data. The new functions include:

  • CreatePoint – Identifies a GeoJSON point.
  • CreateLineString – Identifies a GeoJSON line string.
  • CreatePolygon – Identifies a GeoJSON polygon.
  • ST_DISTANCE – Determines the distance between two points in meters.
  • ST_OVERLAPS – Determines if one polygon overlaps with another.
  • ST_INTERSECTS – Determines if two line strings intersect.
  • ST_WITHIN – Determines if one polygon is contained inside another.

The ability to reason about geospatial data in motion using a declarative SQL like language Simplified queries for geospatial scenarios would look as follows:

Generate an event when a gas station is less than 10 km from the car:

SELECT Cars.Location, Station.Location 
FROM Cars c  
JOIN Station s ON ST_DISTANCE(c.Location, s.Location) < 10 * 1000 

Generate an event when:

  • Fuel level in the car is lower than 10%
  • Gas stations have a promotion
  • The car is pointing to gas station
SELECT Cars.gas, Cars.Location, Cars.Course, Station.Location, Station.Promotion 
FROM Cars c 
JOIN Station s ON Cars.gas < 0.1 AND Station.Promotion AND ST_OVERLAPS(c.Location, c.course) 

Generate an event when building is within a possible flooding zone:

SELECT Building.Polygon, Building.Polygon 
FROM Building b 
JOIN Flooding f ON ST_OVERLAPS(b.Polygon, b.Polygon) 

Generate an event when a storm is heading towards a car:

SELECT Cars.Location, Storm.Course
FROM Cars c, Storm s
JOIN Storm s ON ST_OVERLAPS(c.Location, s.Course)

The integration with Power BI enables live visualizations of geospatial data on maps in real-time dashboards. It is also possible to use Geospatial functions for actualizing scenarios such as identifying and auctioning on hotspots and groupings and visualize data using heat maps on a Bing Maps canvas.

Live Heat Map

Live heat maps using machine learning and geospatial analytics can help unlock better business outcomes for ride-sharing and fleet management scenarios.


This video shows a fleet monitoring example built using the functionality detailed above.

Fleet Monitoring US

Fleet monitoring with Geospatial functions in Azure Stream Analytics

The GeoSpatial Functions documentation page covers detailed documentation and usage examples. We are excited for you try out geospatial functions using Azure Stream Analytics.

  • Explore


    Let us know what you think of Azure and what you would like to see in the future.


    Provide feedback

  • Build your cloud computing and Azure skills with free courses by Microsoft Learn.


    Explore Azure learning

Join the conversation

Leave a Reply

Your email address will not be published. Required fields are marked *