用法:
arcgis.features.find_locations.derive_new_locations(input_layers=[], expressions=[], output_name=None, context=None, gis=None, estimate=False, future=False)
参数:
- input_layers:
所需的要素图层列表。将在表达式参数中使用的图层列表。列表中的每一层可以是:
- 具有可选过滤器以选择特定要素的要素服务图层,或
- 一个特征集合
- expressions:
必需的字典。有两种类型的表达式,属性和空间。
示例属性表达式:
- {
- “operator”:“and”, “layer”:0,“where”:“状态=‘空缺’”
and
或者or
* layer 是图层中的索引input_layers
范围。 * where 子句必须用双引号括起来。 * 处理文本字段时,值必须是单引号(‘VACANT’)。 * 日期字段支持除 LIKE 之外的所有查询。日期是 YYYY:MM:DD hh:mm:ss 格式的字符串。这是一个使用日期字段 ObsDate 的示例:“where”:“ObsDate >= ‘1998-04-30 13:30:00’”- = 平等的
- > 比...更棒
- < 少于
- >= 大于或等于
- <= 小于或等于
- <> 不相等
- 喜欢'% <字符串>' 百分号 (%) 表示通配符,表示其 place-one 字符、一百个字符或无字符均可接受。此表达式将在美国州名中选择密西西比州和密苏里州:STATE_NAME LIKE ‘Miss%’
- <value1> 和 <value2> 之间 如果记录的值大于或等于 <value1> 且小于或等于 <value2>,则选择该记录。例如,此表达式选择 HHSIZE 值大于或等于 3 且小于或等于 10 的所有记录: HHSIZE 介于 3 和 10 之间 以上等价于: HHSIZE >= 3 AND HHSIZE <= 10 此运算符适用于数字或日期字段。以下是字段 ObsDate 上的日期查询示例: ObsDate 在‘1998-04-30 00:00:00’和‘1998-04-30 23:59:59’之间 时间是可选的。
- 不在 <value1> 和 <value2> 之间 如果记录的值超出 <value1> 和小于或等于 <value2> 的范围,则选择该记录。例如,此表达式选择 HHSIZE 值小于 5 且大于 7 的所有记录。 HHSIZE 不在 5 和 7 之间 以上等价于: HHSIZE < 5 或 HHSIZE > 7 此运算符适用于数字或日期字段。 注意 您可以使用包含点和线的关系。例如,您有一层街道中心线(线)和一层井盖(点),并且您想要查找包含井盖的街道。您可以使用 contains 来查找包含井盖的街道,但要使一条线包含一个点,该点必须正好在线上(即,在 GIS 术语中,它们相互捕捉)。如果对此有任何疑问,请使用具有合适距离值的 withinDistance 关系。
“operator”:“and”, “layer”:0,“spatialRel”:“withinDistance”,“selectingLayer”:1,“distance”:10,“units”:“miles”- 运算符可以是
and
或or
- layer 是
the input_layers
参数中图层的索引。表达式的结果就是这一层的特征。 - spatialRel 是空间关系。有九种空间关系。
- distance 是用于 withinDistance 和 notWithinDistance 空间关系的距离。
- 单位是距离的单位。
- 空间关系 说明
- 相交
不相交
如果图层中的要素与选择图层中要素的任何部分重叠,则图层中的要素通过相交测试,包括触摸(要素共享公共点)。
- intersects-If 层中的特征与选择层中的特征相交,层中的特征与选择层中的特征相交的部分包含在输出中。
- notintersects-If 层中的特征与选择层中的特征相交,层中与选择层中的特征相交的部分从输出中排除。
- 距离内
不在距离内
距离内关系使用层中的要素与选择层中的要素之间的straight-line 距离。 withinDistance-The 层中的特征部分在选择层中的特征的指定距离内包含在输出中。 notwithinDistance-The 在选择层中的特征的指定距离内的层中的特征部分从输出中排除。你可以把这种关系想象成“远比”。
- 包含
不包含
如果层中的特征完全包围选择层中的特征,则层中的特征通过此测试。没有包含特征的部分;但是,包含的要素可以接触包含要素(即,沿其边界共享一个公共点)。 contains-If 层中的特征包含选择层中的特征,层中的特征包含在输出中。 notcontains-If layer in a feature contains a feature in selectionLayer,第一层的特征被排除
- 之内
不在范围内
如果层中的特征完全被选择层中的特征包围,则层中的特征通过此测试。整个要素图层必须在包含要素内;但是,允许这两个特征接触(即,沿其边界共享一个公共点)。
- within-If 层中的特征完全在选择层中的特征内,层中的特征包含在输出中。
- notwithin-If 层中的特征完全在选择层中的特征内,层中的特征被排除在输出之外。
- 最近的
如果第一层中的特征最接近第二层中的特征,则它通过此测试。
- nearest-If 第一层的特征与第二层的特征最接近,第一层的特征包含在输出中。
- output_name:
可选字符串或
FeatureLayer
FeatureCollection
- context:
可选字典。处理范围和输出空间参考等附加设置。对于derive_new_locations,有三个设置。
extent
- 定义分析区域的边界框。仅分析input_layer 中与边界框相交的那些特征。outSR
- 输出要素将投影到wkid
引用的输出空间参考中。overwrite
- 如果为 True,则 output_name 中的要素层将被新要素层覆盖。# Example Usage context = {"extent": {"xmin": 3164569.408035, "ymin": -9187921.892449, "xmax": 3174104.927313, "ymax": -9175500.875353, "spatialReference":{"wkid":102100,"latestWkid":3857}}, "outSR": {"wkid": 3857}, "overwrite": True}
- gis: 可选,运行此工具的 GIS。如果未指定,则使用活动 GIS。
- estimate: 可选的布尔值。为真,运行操作所需的积分数将作为浮点数返回。
- future: 可选的布尔值。如果为 True,则结果将是一个 GPJob 对象,并且结果将异步返回。
返回:
FeatureLayer
FeatureCollection
derive_new_locations
方法从满足您指定的查询的输入图层派生新特征。查询由一个或多个表达式组成。有两种类型的表达式:属性和空间。属性表达式的一个示例是宗地必须是空的,这是宗Map层的一个属性 (STATUS = ‘VACANT’)。空间表达式的一个示例是,宗地也必须在河流的一定距离内(距离河流 0.75 英里范围内的宗地)。derive_new_locations
方法与find_existing_locations
方法非常相似,主要区别在于derive_new_locations
的结果可以包含部分特征。在这两种方法中,属性表达式
where
以及其中的空间关系和包含返回相同的结果。这是因为这些关系会返回整个特征。当使用
intersects
或within_distance
时,derive_new_locations
在结果中创建新特征。例如,当一个宗地要素和一个部分重叠的洪水区相交时,find_existing_locations
将返回整个宗地,而derive_new_locations
将仅返回洪水区内的部分宗地。
例子:
# USAGE EXAMPLE: To Identify areas that are suitable cougar habitat using the criteria defined by experts. new_location = derive_new_locations(input_layers=[slope, vegetation, streams, highways], expressions=[{"operator":"","layer":0,"selectingLayer":1,"spatialRel":"intersects"}, {"operator":"and","layer":0,"selectingLayer":2,"spatialRel":"withinDistance","distance":500,"units":"Feet"}, {"operator":"and","layer":0,"selectingLayer":3,"spatialRel":"notWithinDistance","distance":1500,"units":"Feet"}, {"operator":"and","layer":0,"where":"GRIDCODE = 1"}], output_name='derive_new_loactions')
- input_layers:
所需的要素图层列表。将在表达式参数中使用的图层列表。列表中的每一层可以是:
相关用法
- Python arcgis.features.find_locations.find_similar_locations用法及代码示例
- Python arcgis.features.find_locations.create_watersheds用法及代码示例
- Python arcgis.features.find_locations.choose_best_facilities用法及代码示例
- Python arcgis.features.find_locations.trace_downstream用法及代码示例
- Python arcgis.features.find_locations.create_viewshed用法及代码示例
- Python arcgis.features.analysis.derive_new_locations用法及代码示例
- Python arcgis.features.analyze_patterns.calculate_density用法及代码示例
- Python arcgis.features.analysis.summarize_within用法及代码示例
- Python arcgis.features.Table.get_unique_values用法及代码示例
- Python arcgis.features.Table.append用法及代码示例
- Python arcgis.features.analysis.overlay_layers用法及代码示例
- Python arcgis.features.enrich_data.enrich_layer用法及代码示例
- Python arcgis.features.manage_data.merge_layers用法及代码示例
- Python arcgis.features.analysis.connect_origins_to_destinations用法及代码示例
- Python arcgis.features.FeatureLayer.append用法及代码示例
- Python arcgis.features.FeatureLayer.calculate用法及代码示例
- Python arcgis.features.analysis.create_route_layers用法及代码示例
- Python arcgis.features.elevation.profile用法及代码示例
- Python arcgis.features.summarize_data.summarize_center_and_dispersion用法及代码示例
- Python arcgis.features.GeoAccessor.length用法及代码示例
- Python arcgis.features.FeatureLayer.fromitem用法及代码示例
- Python arcgis.features.use_proximity.find_nearest用法及代码示例
- Python arcgis.features.analysis.trace_downstream用法及代码示例
- Python arcgis.features.summarize_data.aggregate_points用法及代码示例
- Python arcgis.features.FeatureLayer.manager用法及代码示例
注:本文由纯净天空筛选整理自arcgis.com大神的英文原创作品 arcgis.features.find_locations.derive_new_locations。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。