Find_hot_spots unexpected argument

213
3
05-06-2021 08:55 AM
HenriqueJoner
New Contributor II

Hello, 

I'm trying to create a hotspots anaylsis from my feature layer but i'm receiving this message:

find_hot_spots() got an unexpected keyword argument 'shape_type'

 Doesn't matter how i ask it to do it, this message appear inclusive when i does not provide a shape type argument.

Ps: i'm calling it from : "from arcgis.features.analysis import find_hot_spots"

Thank's

Tags (2)
0 Kudos
3 Replies
DanPatterson
MVP Honored Contributor

It is there.

from arcgis.features.analysis import find_hot_spots

dir(find_hot_spots)
['__annotations__', '__call__', '__class__', '__closure__', '__code__', 
 '__defaults__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__',
 '__format__', '__ge__', '__get__', '__getattribute__', '__globals__',
 '__gt__', '__hash__', '__init__', '__init_subclass__', '__kwdefaults__',
 '__le__', '__lt__', '__module__', '__name__', '__ne__', '__new__',
 '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__',
 '__sizeof__', '__str__', '__subclasshook__']

What version of arcgis are you using?

If the import failed, then something is wrong with your install or it isn't the latest versionl

If it is failing when you are trying to use it, that is a different issue.


... sort of retired...
0 Kudos
HenriqueJoner
New Contributor II

I'm using 1.8.4 version of arcgis python API.

Importing its ok, my problem is when im using it...

0 Kudos
DanPatterson
MVP Honored Contributor

There is builtin help or you can refer to the documentation if needed.  Check your input parameters

help(find_hot_spots)

Help on function find_hot_spots in module arcgis.features.analyze_patterns:

find_hot_spots(analysis_layer, analysis_field=None, divided_by_field=None, bounding_polygon_layer=None, aggregation_polygon_layer=None, output_name=None, context=None, gis=None, estimate=False, shape_type=None, cell_size=None, cell_size_unit=None, distance_band=None, distance_band_unit=None, future=False)
.. image:: _static/images/find_hot_spots/find_hot_spots.png

The ``find_hot_spots`` method analyzes point data (such as crime incidents, traffic accidents, or trees) or field values associated with
points or area features (such as the number of people in each census tract or the total sales for retail stores). It finds statistically
significant spatial clusters of high values (hot spots) and low values (cold spots). For point data when no field is specified, hot spots
are locations with lots of points and cold spots are locations with very few points.

The result map layer shows hot spots in red and cold spots in blue. The darkest red features indicate the strongest clustering of high values
or point densities; you can be 99 percent confident that the clustering associated with these features could not be the result of random chance.
Similarly, the darkest blue features are associated with the strongest spatial clustering of low values or the lowest point densities.
Features that are beige are not part of a statistically significant cluster; the spatial pattern associated with these features could very likely
be the result of random processes and random chance.

===================================================================
**Argument** **Description**
------------------------------------------------------------------- 
analysis_layer (Required if the analysis_layer contains polygons) Required
layer. The point or polygon feature layer for which hot spots will be 
calculated. See :ref:`Feature Input<FeatureInput>`.
-------------------------------------------------------------------
analysis_field Optional string. The numeric field that will be analyzed. The field you select might represent:

+ counts (such as the number of traffic accidents)
+ rates (such as the number of crimes per square mile)
+ averages (such as the mean math test score)
+ indices (such as a customer satisfaction score)

If an ``analysis_field`` is not supplied, hot spot results are based on point densities only.
------------------------------------------------------------------- 
divided_by_field Optional string. The numeric field in the ``analysis_layer`` that will be used to normalize your data.
For example, if your points represent crimes, dividing by total population would result in an analysis of crimes per capita rather than raw crime counts.

You can use esriPopulation to geoenrich each area feature with the most recent population values, which will then be
used as the attribute to divide by. This option will use credits.
------------------------------------------------------------------- 
bounding_polygon_layer Optional layer. When the analysis layer is points and no ``analysis_field`` is specified, you can provide polygons features that define where incidents could have occurred.
For example, if you are analyzing boating accidents in a harbor, the outline of the harbor might provide a good boundary for where accidents could occur.
When no bounding areas are provided, only locations with at least one point will be included in the analysis. See :ref:`Feature Input<FeatureInput>`.
-------------------------------------------------------------------
aggregation_polygon_layer Optional layer. When the ``analysis_layer`` contains points and no ``analysis_field`` is specified,
you can provide polygon features into which the points will be aggregated and analyzed, such as administrative units.
The number of points that fall within each polygon are counted, and the point count in each polygon is analyzed. See :ref:`Feature Input<FeatureInput>`.
-------------------------------------------------------------------
output_name Optional string. If provided, the task will create a feature service of the results.
You define the name of the service. If ``output_name`` is not supplied, the task will return a feature collection.
-------------------------------------------------------------------
context Optional string. Context contains additional settings that affects method execution. For ``find_hot_spots``, there are two settings.

#. Extent (``extent``) - a bounding box that defines the analysis area. Only those features in the ``analysis_layer`` that intersect the bounding box will be analyzed.
#. Output Spatial Reference (``outSR``) - the data will be projected into the output spatial reference prior to analysis.
------------------------------------------------------------------- 
gis Optional, the GIS on which this tool runs. If not specified, the active GIS is used.
-------------------------------------------------------------------
estimate Optional Boolean. Is true, the number of credits needed to run the operation will be returned as a float.
-------------------------------------------------------------------
shape_type Optional string. The shape of the polygon mesh the input features will be aggregated into.

* ``Fishnet``-The input features will be aggregated into a grid of square (fishnet) cells.
* ``Hexagon``-The input features will be aggregated into a grid of hexagonal cells.
-------------------------------------------------------------------
cell_size Optional float. The size of the grid cells used to aggregate your features.
When aggregating into a hexagon grid, this distance is used as the height to construct the hexagon polygons.
------------------------------------------------------------------- 
cell_size_unit Optional string. The units of the ``cell_size`` value. You must provide a value if ``cell_size`` has been set.

Choice list: ['Meters', 'Miles', 'Feet', 'Kilometers']
-------------------------------------------------------------------
distance_band Optional float. The spatial extent of the analysis 
neighborhood. This value determines which features are analyzed together
in order to assess local clustering.
-------------------------------------------------------------------
distance_band_unit Optional string. The units of the ``distance_band``
 value. You must provide a value if ``distance_band`` has been set.
-------------------------------------------------------------------
future Optional boolean. If True, the result will be a GPJob object and results will be returned asynchronously.
=================================================================== 
:returns: result_layer : feature layer Item if output_name is specified, else a dictionary with a Feature Collection and processing messages.

.. code-block:: python

USAGE EXAMPLE: To find significant hot ot cold spots of collisions involving a bicycle within a specific boundary.
collision_hot_spots = find_hot_spots(collisions,
bounding_polygon_layer=boundry_lyr,
output_name='collision_hexagon_hot_spots',
shape_type='hexagon')

... sort of retired...
0 Kudos