用法:
arcgis.geoanalytics.find_locations.find_similar_locations(input_layer, search_layer, analysis_fields, most_or_least_similar: str = 'MostSimilar', match_method: str = 'AttributeValues', number_of_results: int = 10, append_fields: str = None, output_name: str = None, gis=None, context=None, future=False, return_tuple=False)
参数:
- 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_类似:
可选字符串。您想要返回的函数。您可以搜索与
input_layer
最相似或最不相似的特征,或者同时搜索最相似和最不相似的特征。 选择列表:[‘MostSimilar’, ‘LeastSimilar’, ‘Both’] 默认值为“最相似”。 - match_method:
可选字符串。您选择的方法决定了如何确定匹配。
选择列表:[‘AttributeValues’, ‘AttributeProfiles’]
AttributeValues
方法使用标准化值的平方差。AttributeProfiles
方法使用余弦相似度数学来比较标准化值的轮廓。使用AttributeProfiles
需要使用至少两个分析字段。
- number_of_results:
可选整数。排名候选位置的数量输出到
similar_result_layer
。如果未设置number_of_results
,则返回 10 个位置。结果的最大数量为 10000。 默认值为 10。 - append_fields: 可选字符串。 (可选)将字段从您的搜索图层添加到您的数据。默认情况下,将附加搜索图层中的所有字段。
- output_name: 可选字符串。该任务将创建结果的要素服务。您定义服务的名称。
- gis: 可选的地理信息系统。运行此工具的 GIS。如果未指定,则使用活动 GIS。
- context:
可选字典。 context 参数包含影响任务执行的其他设置。对于此任务,有四个设置:
- 范围 (
extent
) - 定义分析区域的边界框。只有那些与边界框相交的特征才会被分析。 - 处理空间参考 (
processSR
) - 要素将投影到此坐标系中以进行分析。 - 输出空间参考 (
outSR
) - 分析后要素将投影到此坐标系中以保存。时空大数据存储的输出空间参考始终为 WGS84。 - 数据存储 (
dataStore
) - 结果将保存到指定的数据存储。对于ArcGIS Enterprise,默认为时空大数据存储。
- 范围 (
- future: 可选的布尔值。如果为“真”,则返回 GPJob 而不是结果。可以查询GPJob 的执行状态。 默认值为“假”。
- return_tuple: 可选的布尔值。如果为“True”,则返回具有多个输出键的命名元组。 默认值为“假”。
返回:
如果
return_tuple
设置为“True”,则使用以下键命名元组:”output”:
FeatureLayer
“process_info”:列表
find_similar_locations
任务测量候选位置与一个或多个参考位置的相似性。根据您指定的标准,
find_similar_locations
可以回答以下问题:在客户资料方面,您的哪些商店与您的表现最佳的商店最相似?
根据疫情重灾村的特点,还有哪些村是高危村?
要回答此类问题,您需要提供参考位置(
input_layer
参数)、候选位置(search_layer
参数)以及表示您要匹配的条件的字段。例如,input_layer
可能是包含表现最佳的商店或受疾病影响最严重的村庄的图层。search_layer
包含要搜索的候选位置。这可能是您所有的商店或所有其他村庄。最后,您提供一个用于测量相似性的字段列表。find_similar_locations
任务将根据所有候选位置在您选择的所有字段中与参考位置的匹配程度来对所有候选位置进行排名。
否则返回结果的
FeatureLayer
例子:
# 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")
- input_layer:
必需的层。
相关用法
- Python arcgis.geoanalytics.find_locations.detect_incidents用法及代码示例
- Python arcgis.geoanalytics.find_locations.geocode_locations用法及代码示例
- Python arcgis.geoanalytics.summarize_data.reconstruct_tracks用法及代码示例
- Python arcgis.geoanalytics.analyze_patterns.forest用法及代码示例
- Python arcgis.geoanalytics.manage_data.overlay_data用法及代码示例
- Python arcgis.geoanalytics.manage_data.run_python_script用法及代码示例
- Python arcgis.geoanalytics.analyze_patterns.find_hot_spots用法及代码示例
- Python arcgis.geoanalytics.manage_data.clip_layer用法及代码示例
- Python arcgis.geoanalytics.data_enrichment.enrich_from_grid用法及代码示例
- Python arcgis.geoanalytics.summarize_data.describe_dataset用法及代码示例
- Python arcgis.geoanalytics.manage_data.calculate_fields用法及代码示例
- Python arcgis.geoanalytics.summarize_data.join_features用法及代码示例
- Python arcgis.geoanalytics.analyze_patterns.calculate_density用法及代码示例
- Python arcgis.geoanalytics.summarize_data.summarize_within用法及代码示例
- Python arcgis.geoanalytics.summarize_data.summarize_attributes用法及代码示例
- Python arcgis.geoanalytics.summarize_data.build_multivariable_grid用法及代码示例
- Python arcgis.geoanalytics.analyze_patterns.glr用法及代码示例
- Python arcgis.geoanalytics.manage_data.copy_to_data_store用法及代码示例
- Python arcgis.geoanalytics.analyze_patterns.create_space_time_cube用法及代码示例
- Python arcgis.geoanalytics.summarize_data.aggregate_points用法及代码示例
- Python arcgis.geoanalytics.use_proximity.create_buffers用法及代码示例
- Python arcgis.geometry.functions.trim_extend用法及代码示例
- Python arcgis.geometry.Geometry.label_point用法及代码示例
注:本文由纯净天空筛选整理自arcgis.com大神的英文原创作品 arcgis.geoanalytics.find_locations.find_similar_locations。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。