ST_Geometry Aggregate Functions for Hive in Spatial Framework for Hadoop

We are pleased to announce that the ST_Geometry aggregate functions are now available for Hive, in the Spatial Framework for Hadoop. The aggregate functions can be used to perform a convex-hull, intersection, or union operation on geometries from multiple records of a dataset.

While the non-aggregate ST_ConvexHull function returns the convex hull of the geometries passed like a single function call, the ST_Aggr_ConvexHull function accumulates the geometries from the rows selected by a query, and performs a convex hull operation over those geometries. Likewise, ST_Aggr_Intersection and ST_Aggr_Union aggregrate the geometries from multiple selected rows, to perform intersection and union operations, respectively.

The following is an example of using ST_Aggr_Union on the earthquake and California-county data included with the samples in GIS Tools for Hadoop:

SELECT ST_AsText(ST_Aggr_Union(ST_Point(earthquakes.longitude, earthquakes.latitude)))
FROM earthquakes
JOIN counties_json counties
WHERE counties.name = ‘San Bernardino’
AND earthquakes.magnitude > 6
AND ST_Contains(counties.shape, ST_Point(earthquakes.longitude, earthquakes.latitude));

The result of this example query is a single MultiPoint:

MULTIPOINT ((-116.437 34.2), (-116.827 34.203), (-116.271 34.594), (-116.5315 34.9828))

This post was contributed by Randall Whitman

This entry was posted in Geodata and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

One Comment

  1. scrim says:

    Does Spatial Framework for Hadoop or any arcgis hadoop aapplication does any arcpy function mainly feaureCLass for python or Hive?