Home
%3CLINGO-SUB%20id%3D%22lingo-sub-990724%22%20slang%3D%22en-US%22%3EJust%20shipped%3A%20Geospatial%20functions%20support%20in%20Azure%20Data%20Explorer%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-990724%22%20slang%3D%22en-US%22%3E%3CP%3EWe%20are%20excited%20to%20announce%20that%20we%20just%20released%20the%20first%20set%20of%20geospatial%20functions%20in%20Azure%20Data%20Explorer!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1853303689%22%20id%3D%22toc-hId-1853304587%22%3EGeohash%20support%3C%2FH2%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FGeohash%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3EGeohashes%3C%2FA%3E%20are%20a%20beautiful%20way%20to%20store%20locations%20in%20a%20single%20column%20with%20a%20precision%20based%20on%20the%20length%20of%20the%20hash.%20This%20enables%20the%20user%20to%20summarize%20data%20on%20geographical%20buckets.%20We%20are%20supporting%20the%20transformation%20from%20points%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fkusto%2Fquery%2Fgeo-point-to-geohash-function%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eto%3C%2FA%3E%20geohashes%20and%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fkusto%2Fquery%2Fgeo-geohash-to-central-point-function%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eback%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--698853272%22%20id%3D%22toc-hId--698852374%22%3EContains%20operations%3C%2FH2%3E%0A%3CP%3EOne%20of%20the%20most%20exciting%20new%20capabilities%20of%20KQL%20is%20the%20way%20to%20analyze%20if%20a%20given%20point%20is%20contained%20in%20a%20circle%20or%20a%20polygon.%26nbsp%3B%3CSPAN%3EThe%20geospatial%20coordinates%20are%20based%20on%20the%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fearth-info.nga.mil%2FGandG%2Fupdate%2Findex.php%3Faction%3Dhome%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%20data-linktype%3D%22external%22%3EWGS-84%3C%2FA%3E%3CSPAN%3E%26nbsp%3Bcoordinate%20reference%20system%20and%20the%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FGeodetic_datum%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%20data-linktype%3D%22external%22%3Egeodetic%20datum%3C%2FA%3E%26nbsp%3Bused%20for%20measurements%20on%20earth%20is%20a%20sphere.%20Polygon%20edges%20are%20geodesics%20on%20the%20sphere.%20Over%20time%20we%20are%20going%20to%20extend%20the%20functionality%20even%20further.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-847443558%22%20id%3D%22toc-hId-847444456%22%3EExample%3C%2FH3%3E%0A%3CP%3ELet's%20try%20to%20get%20all%20interesting%20buildings%20given%20on%20a%20polygon%20like%20this%3A%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20696px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F155557i2FB79ED53EAB30A0%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22polygon_manhattan_with_hole.png%22%20title%3D%22polygon_manhattan_with_hole.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20following%20query%20leverages%20the%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fkusto%2Fquery%2Fgeo-point-in-polygon-function%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Egeo-point-in-polygon%3C%2FA%3E%26nbsp%3Bfunction%20and%20the%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FGeoJSON%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3EGeoJSON%3C%2FA%3E%26nbsp%3Brepresenation%20of%26nbsp%3B%3CSPAN%3EManhattan%20island%20without%20Central%20Park%20in%20order%20to%20project%20all%20places%20in%20the%20polygon.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3Edatatable(longitude%3Areal%2C%20latitude%3Areal%2C%20place%3Astring)%0A%5B%0A%20%20%20%20real(-73.985654)%2C%2040.748487%2C%20'Empire%20State%20Building'%2C%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20In%20Polygon%20%0A%20%20%20%20real(-73.963249)%2C%2040.779525%2C%20'The%20Metropolitan%20Museum%20of%20Art'%2C%20%20%2F%2F%20In%20exterior%20of%20polygon%0A%20%20%20%20real(-73.874367)%2C%2040.777356%2C%20'LaGuardia%20Airport'%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20In%20exterior%20of%20polygon%0A%5D%0A%7C%20where%20geo_point_in_polygon(longitude%2C%20latitude%2C%20dynamic(%7B%22type%22%3A%22Polygon%22%2C%22coordinates%22%3A%5B%5B%5B-73.92597198486328%2C40.87821814104651%5D%2C%5B-73.94691467285156%2C40.85069618625578%5D%2C%5B-73.94691467285156%2C40.841865966890786%5D%2C%5B-74.01008605957031%2C40.7519385984599%5D%2C%5B-74.01866912841797%2C40.704586878965245%5D%2C%5B-74.01214599609375%2C40.699901911003046%5D%2C%5B-73.99772644042969%2C40.70875101828792%5D%2C%5B-73.97747039794922%2C40.71083299030839%5D%2C%5B-73.97026062011719%2C40.7290474687069%5D%2C%5B-73.97506713867186%2C40.734510840309376%5D%2C%5B-73.970947265625%2C40.74543623770158%5D%2C%5B-73.94210815429688%2C40.77586181063573%5D%2C%5B-73.9434814453125%2C40.78080140115127%5D%2C%5B-73.92974853515625%2C40.79691751000055%5D%2C%5B-73.93077850341797%2C40.804454347291006%5D%2C%5B-73.93489837646484%2C40.80965166748853%5D%2C%5B-73.93524169921875%2C40.837190668541105%5D%2C%5B-73.92288208007812%2C40.85770758108904%5D%2C%5B-73.9101791381836%2C40.871728144624974%5D%2C%5B-73.92597198486328%2C40.87821814104651%5D%5D%2C%5B%5B-73.95824432373047%2C40.80071852197889%5D%2C%5B-73.98206233978271%2C40.76815921628347%5D%2C%5B-73.97309303283691%2C40.76422632379533%5D%2C%5B-73.94914627075195%2C40.796949998204596%5D%2C%5B-73.95824432373047%2C40.80071852197889%5D%5D%5D%7D))%0A%7C%20project%20place%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20result%20is%3A%20%22Empire%20State%20Building%22.%20Besides%20the%20polygons%20it's%20also%20possible%20to%20define%20regions%20based%20on%20circles%20and%20make%20use%20of%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fkusto%2Fquery%2Fgeo-point-in-circle-function%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Egeo-point-in-circle%3C%2FA%3E%26nbsp%3B.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1508199898%22%20id%3D%22toc-hId--1508199000%22%3EWhat%20to%20do%20next%3F%3C%2FH2%3E%0A%3CP%3EGo%20out%20and%20try%20it%20yourself%20on%20exciting%20open%20datasets%20like%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fservices%2Fopen-datasets%2Fcatalog%2Fnyc-taxi-limousine-commission-for-hire-vehicle-trip-records%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3ENYC-taxi%3C%2FA%3E%26nbsp%3Bor%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fservices%2Fopen-datasets%2Fcatalog%2Fnoaa-integrated-surface-data%2F%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3ENOAA%20integrated%20surface%20data%3C%2FA%3E%26nbsp%3B.%20You%20could%20start%20by%20exploring%20the%20global%20warming%20of%20earth%20by%20analyzing%20the%20average%20temperature%20of%20November%20based%20on%20geohashes%20over%20the%20course%20of%20the%20last%2010%20years%20and%20create%20beautiful%20PowerBI%20visualizations%20like%20this%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20645px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F155554i32BD771AF3A10454%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22warming.png%22%20title%3D%22warming.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPlease%20share%20your%20queries%20on%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FAzure-Data-Explorer%2Fbd-p%2FKusto%22%20target%3D%22_self%22%3E%20Azure%20Data%20Explorer%20community%3C%2FA%3E%26nbsp%3Band%20join%20the%20discussion.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-990724%22%20slang%3D%22en-US%22%3E%3CP%3EEver%20wanted%20to%20execute%20geospatial%20analytics%20on%20your%20data%20in%20ADX%3F%20This%20is%20your%20article!%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-990724%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Data%20Explorer%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Ekql%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EKusto%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

We are excited to announce that we just released the first set of geospatial functions in Azure Data Explorer!

 

Geohash support

Geohashes are a beautiful way to store locations in a single column with a precision based on the length of the hash. This enables the user to summarize data on geographical buckets. We are supporting the transformation from points to geohashes and back.

 

Contains operations

One of the most exciting new capabilities of KQL is the way to analyze if a given point is contained in a circle or a polygon. The geospatial coordinates are based on the WGS-84 coordinate reference system and the geodetic datum used for measurements on earth is a sphere. Polygon edges are geodesics on the sphere. Over time we are going to extend the functionality even further.

 

Example

Let's try to get all interesting buildings given on a polygon like this:

polygon_manhattan_with_hole.png

 

The following query leverages the geo-point-in-polygon function and the GeoJSON represenation of Manhattan island without Central Park in order to project all places in the polygon.

 

datatable(longitude:real, latitude:real, place:string)
[
    real(-73.985654), 40.748487, 'Empire State Building',           // In Polygon 
    real(-73.963249), 40.779525, 'The Metropolitan Museum of Art',  // In exterior of polygon
    real(-73.874367), 40.777356, 'LaGuardia Airport',               // In exterior of polygon
]
| where geo_point_in_polygon(longitude, latitude, dynamic({"type":"Polygon","coordinates":[[[-73.92597198486328,40.87821814104651],[-73.94691467285156,40.85069618625578],[-73.94691467285156,40.841865966890786],[-74.01008605957031,40.7519385984599],[-74.01866912841797,40.704586878965245],[-74.01214599609375,40.699901911003046],[-73.99772644042969,40.70875101828792],[-73.97747039794922,40.71083299030839],[-73.97026062011719,40.7290474687069],[-73.97506713867186,40.734510840309376],[-73.970947265625,40.74543623770158],[-73.94210815429688,40.77586181063573],[-73.9434814453125,40.78080140115127],[-73.92974853515625,40.79691751000055],[-73.93077850341797,40.804454347291006],[-73.93489837646484,40.80965166748853],[-73.93524169921875,40.837190668541105],[-73.92288208007812,40.85770758108904],[-73.9101791381836,40.871728144624974],[-73.92597198486328,40.87821814104651]],[[-73.95824432373047,40.80071852197889],[-73.98206233978271,40.76815921628347],[-73.97309303283691,40.76422632379533],[-73.94914627075195,40.796949998204596],[-73.95824432373047,40.80071852197889]]]}))
| project place

 

The result is: "Empire State Building". Besides the polygons it's also possible to define regions based on circles and make use of geo-point-in-circle .

 

What to do next?

Go out and try it yourself on exciting open datasets like NYC-taxi or NOAA integrated surface data . You could start by exploring the global warming of earth by analyzing the average temperature of November based on geohashes over the course of the last 10 years and create beautiful PowerBI visualizations like this:

warming.png

 

Please share your queries on  Azure Data Explorer community and join the discussion.