本文简要介绍 python 语言中 arcgis.geoanalytics.find_locations.find_similar_locations
的用法。
用法:
arcgis.geoanalytics.find_locations.find_similar_locations(input_layer, search_layer, analysis_fields, most_or_least_similar='MostSimilar', match_method='AttributeValues', number_of_results=10, append_fields=None, output_name=None, gis=None, context=None, future=False, return_tuple=False)
返回:
如果
return_tuple
是True
,具有以下键的命名元组:output
:FeatureLayer
process_info
:列表
如果
return_tuple is ``False`
,FeatureLayer
find_similar_locations
任务测量候选位置与一个或多个参考位置的相似性。根据您指定的标准,
find_similar_locations
可以回答以下问题:Which of your stores are most similar to your top performers with regard to customer profiles?
Based on characteristics of villages hardest hit by the disease, which other villages are high risk?
To answer questions such as these, you provide the reference locations (the
input_layer
parameter), the candidate locations (thesearch_layer
parameter), and the fields representing the criteria you want to match. For example, theinput_layer
might be a layer containing your top performing stores or the villages hardest hit by the disease. Thesearch_layer
contains your candidate locations to search. This might be all of your stores or all other villages. Finally, you supply a list of fields to use for measuring similarity. Thefind_similar_locations
task will rank all of the candidate locations by how closely they match your reference locations across all of the fields you have selected.
Parameter
Description
input_layer
必需的层。
input_layer
包含一个或多个参考位置,search_layer
中的特征将根据这些参考位置进行相似性评估。例如,input_layer
可能包含您表现最好的商店或受疾病影响最严重的村庄。请参阅特征输入。input_layer
和search_layer
是同一个要素服务的情况并不少见。例如,要素服务包含所有商店的位置,其中一个是您表现最好的商店。如果您想将其余商店从最相似到最不相似进行排名,您可以为input_layer
和search_layer
提供过滤器。input_layer
上的过滤器将选择表现最佳的商店,而search_layer
上的过滤器将选择除表现最佳的商店之外的所有商店。您可以使用可选的过滤器参数来指定参考位置。如果有多个参考位置,则相似性将基于您在
analysis_fields
参数中指定的字段的平均值。例如,如果有两个参考位置并且您对匹配人口感兴趣,则该任务将在search_layer
中查找人口最接近两个参考位置的平均人口的候选位置。例如,如果参考位置的值是 100 和 102,则该任务将寻找人口接近 101 的候选位置。因此,您将希望将字段用于具有相似值的参考位置字段。例如,如果一个参考位置的人口值为 100,而另一个为 100,000,则该工具将寻找人口值接近这两个值的平均值的候选位置:50,050。请注意,这个平均值与任何一个参考位置的人口都不同。search_layer
必需的层。包含将根据参考位置评估的候选位置的图层。请参阅特征输入。
analysis_fields
必需的字符串。其值用于确定相似性的字段列表。它们必须是数字字段,并且这些字段必须同时存在于
input_layer
和search_layer
上。根据所选的match_method
,任务将根据字段的值或配置文件查找最相似的特征。most_or_least_similar
可选字符串。您想要返回的函数。您可以搜索与
input_layer
最相似或最不相似的特征,或者同时搜索最相似和最不相似的特征。选择清单:
MostSimilar
LeastSimilar
Both
默认值为
MostSimilar
。match_method
可选字符串。您选择的方法决定了如何确定匹配。
选择清单:
AttributeValues
- uses the squared differences of standardized values.AttributeProfiles
- uses cosine similarity mathematics to compare the profile of standardized values. UsingAttributeProfiles
requires the use of at least two analysis fields.
默认值为
AttributeValues
。number_of_results
可选整数。排名候选位置的数量输出到
similar_result_layer
。如果未设置number_of_results
,则返回 10 个位置。结果的最大数量为 10000。默认值为 10。
append_fields
可选字符串。 (可选)将字段从您的搜索图层添加到您的数据。默认情况下,将附加搜索图层中的所有字段。
output_name
可选字符串。该任务将创建结果的要素服务。您定义服务的名称。
gis
运行此工具的可选
GIS
。如果未指定,则使用活动 GIS。context
可选字典。 context 参数包含影响任务执行的其他设置。对于此任务,有四个设置:
extent
- A bounding box that defines the analysis area. Only those features that intersect the bounding box will be analyzed.processSR
- The features will be projected into this coordinate system for analysis.outSR
- The features will be projected into this coordinate system after the analysis to be saved. The output spatial reference for the spatiotemporal big data store is always WGS84.dataStore
- Results will be saved to the specified data store. For ArcGIS Enterprise, the default is the spatiotemporal big data store.
future
可选布尔值。如果是
True
,将返回一个 future 对象,并且进程不会等待任务完成。默认为
False
,表示等待结果。return_tuple
可选布尔值。如果
True
,则返回具有多个输出键的命名元组。默认值为
False
。例子:
# Usage Example: To find potential retail locations based on the current top locations and their attributes. similar_location_result = find_similar_locations(input_layer=stores_layer, search_layer=locations, analysis_fields="median_income, population, nearest_competitor", most_or_least_similar="MostSimilar", match_method="AttributeValues", number_of_results=50, output_name="similar_locations")
相关用法
- Python ArcGIS find_similar_locations用法及代码示例
- Python ArcGIS find_centroids用法及代码示例
- Python ArcGIS find_point_clusters用法及代码示例
- Python ArcGIS find_existing_locations用法及代码示例
- Python ArcGIS find_nearest用法及代码示例
- Python ArcGIS find_hot_spots用法及代码示例
- Python ArcGIS find_outliers用法及代码示例
- Python ArcGIS find_argument_statistics用法及代码示例
- Python ArcGIS forest用法及代码示例
- Python ArcGIS from_geo_coordinate_string用法及代码示例
- Python ArcGIS flow_direction用法及代码示例
- Python ArcGIS float_divide用法及代码示例
- Python ArcGIS floor_divide用法及代码示例
- Python ArcGIS power用法及代码示例
- Python ArcGIS APIKeyManager.get用法及代码示例
- Python ArcGIS KnowledgeGraph.named_object_type_delete用法及代码示例
- Python ArcGIS ContentManager.unshare_items用法及代码示例
- Python ArcGIS ImageryLayer.thumbnail用法及代码示例
- Python ArcGIS FormFieldElement用法及代码示例
- Python ArcGIS Geometry.true_centroid用法及代码示例
- Python ArcGIS Site.delete用法及代码示例
- Python ArcGIS GeoAccessor.bbox用法及代码示例
- Python arcgis.apps.hub.Initiative.update用法及代码示例
- Python ArcGIS generate_service_areas用法及代码示例
- Python ArcGIS build_overview用法及代码示例
注:本文由纯净天空筛选整理自arcgis.com大神的英文原创作品 arcgis.geoanalytics.find_locations.find_similar_locations。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。