Title Create Quadtrees
Creates quadtrees from a collection of input features.
Quadtree generation is controlled by specifying Maximum Vertices and/or Maximum depth:
- Vertices - The quadtree will be subdivided if it contains more than the maximum number of vertices.
- Vertices & Depth - Same as above, except it will stop subdividing beyond maximum depth.
- Depth - Quadtrees are subdivided maximum depth times.
License
BasicToolset
Subset
CreateQuadTrees (in_features, out_features, {count}, {depth}, {create_empty}, {create_square})
Parameter | Explanation | Data Type |
---|---|---|
in_features |
Dialog Reference
The input features to partition. |
GPFeatureLayer |
out_features |
Dialog Reference
The output polygon feature class. |
DEFeatureClass |
count (Optional) |
Dialog Reference
The maximum number of feature vertices that will be enclosed by each quadtree. |
GPLong |
depth (Optional) |
Dialog Reference
The number of quadtree levels that will be generated. This ranges from 1-32. |
GPLong |
create_empty (Optional) |
Dialog Reference
Controls how quadtrees with no data will be handled.
|
GPBoolean |
create_square (Optional) |
Dialog Reference
Controls the shape of quadtrees.
|
GPBoolean |
CreateQuadTrees example 1 (Python window)
Creates rectangular quadtrees dividing the device class into 10k quadrants.
import arcpy
arcpy.udms.CreateQuadTrees("ElectricDevice", "memory/quads", 10_000)
CreateQuadTrees example 2 (stand-alone script)
Creates quadtrees from all selected features in the map.
import os
import arcpy
aprx = arcpy.mp.ArcGISProject("CURRENT")
# Find all layers with a selection.
layers = [
layer.longName
for layer in aprx.activeMap.listLayers()
if not layer.isBroken and layer.isFeatureLayer and layer.getSelectionSet()
]
arcpy.udms.CreateQuadTrees(
in_features=layers,
out_features=os.path.join(aprx.defaultGeodatabase, "quadTrees"),
count=None,
depth=3,
create_empty=False,
create_square=True,
)