Executing big data tools¶
The GeoAnalytics tools are presented through a set of sub modules within the geoanalytics
module. To view the list of tools available, refer to the page titled Working with big data. In this page, we will learn how to execute big data tools.
Ensuring your GIS supports GeoAnalytics¶
Before executing a tool, we need to ensure an ArcGIS Enterprise GIS is set up with a licensed GeoAnalytics server. To do so, call the is_supported()
method after connecting to your Enterprise portal. See the Components of ArcGIS URLs documentation for details on the urls to enter in the GIS
parameters based on your particular Enterprise configuration.
# connect to Enterprise GIS
from arcgis.gis import GIS
import arcgis.geoanalytics
gis = GIS("your_gis_portal_url", "username", "password")
# check if GeoAnalytics is supported
arcgis.geoanalytics.is_supported()
When no parameters are specified with geoanalytics
methods, they use the active GIS connection, which you can query with the arcgis.env.active_gis
property. However, if you are working with more than one GIS object, you can specify the desired GIS object as the gis
parameter of this method. For example, let us create a connection to an Enterprise deployment and check if GeoAnalytics is supported.
ago_gis = GIS("https://geoinfo_portal.esri.com/portal", "username", "password")
arcgis.geoanalytics.is_supported(ago_gis)
search_result = gis.content.search("", item_type = "big data file share")
search_result
data_item = search_result[3]
data_item.layers
earthquakes = data_item.layers[0]
earthquakes
Executing the Aggregate Points tool¶
Access the aggregate_points()
tool through the summarize_data
module. This example uses the Aggregate Points tool to aggregate the point features representing earthquakes into 1 Kilometer square bins. The tool creates an output feature layer in your portal you can access once processing is complete.
from arcgis.geoanalytics.summarize_data import aggregate_points
The GeoAnalytics Tools use a process spatial reference during execution. Analyses with square or hexagon bins require a projected coordinate system. We'll use the World Cylindrical Equal Area projection (WKID 54034) below (as it is the default used when running tools in ArcGIS Online). All results are stored in the spatiotemporal datastore of the Enterprise in the WGS 84 Spatial Reference.
See the GeoAnalytics Documentation for a full explanation of analysis environment settings.
arcgis.env.process_spatial_reference=54034
The ArcGIS Platform, including the ArcGIS API for Python, manages and transforms geographic data with a large suite of tools and functions collectively known as geoprocessing. The GeoAnalytics Tools in the ArcGIS API for Python are a subset of geoprocessing tools, and operate in the context of a geoprocessing environment. You can set various aspects of this environment to control how tools are executed and what messages you receive during and after the execution. See the Logging and error handling section in the API for Python Geoprocessing Guide Advanced concepts for ways to control messaging, including the arcgis.env.verbose
setting.
import arcgis.env
arcgis.env.verbose=True
agg_result = aggregate_points(earthquakes, bin_size=1, bin_size_unit='Kilometers', output_name='EQAgg_5mi_hex')
The aggregate points tool, just like may other GeoAnalytics tools returns a feature layer item which contains the processed results.
Feedback on this topic?