Generate Tessellation (Data Management)

Summary

Generates a tessellated grid of regular polygon features to cover a given extent. The tessellation can be of triangles, squares, diamonds, hexagons, H3 hexagons, or transverse hexagons.

Illustration

Generate Tessellation tool illustration

Usage

  • To ensure that the entire input extent is covered by the tessellated grid, the output features purposely extend beyond the input extent. This occurs because the edges of the tessellated grid will not always be straight lines, and gaps would be present if the grid was limited by the input extent.

  • The GRID_ID field will be added to the output.

    When the Shape Type parameter value is H3 hexagon, the GRID_ID field values will be a unique hierarchical index for each cell.

    GRID_ID field values for H3 hexagons with a size value of 3

    For all other Shape Type parameter values, the GRID_ID field will be a unique ID for each feature. The format for the IDs is A-1, A-2, B-1, B-2, and so on. This allows for easy selection of rows and columns by query using the Select Layer By Attribute tool. For example, select all features in column A with GRID_ID like 'A-%', or select all features in row 1 with GRID_ID like '%-1'.

  • To generate a grid that excludes tessellation features that do not intersect features in another dataset, use the Select Layer By Location tool to select output polygons that contain the source features, and use the Copy Features tool to make a permanent copy of the selected output features to a new feature class.

  • The tool generates shapes by areal units. To determine the area of a shape based on the length of a side, use one of the following formulas to calculate the value of the Size parameter:

    ShapeFormulaExample

    Hexagon or Transverse hexagon

    Area of a hexagon formula

    To generate hexagons with a side length of 100 meters, specify the Size parameter value of 25980.76211353316 square meters (100 raised to the power of 2 multiplied by 3 multiplied by the square root of 3 divided by 2).

    Square

    Area of a square formula

    To generate squares with a side length of 100 meters, specify the Size parameter value of 10,000 square meters (100 raised to the power of 2).

    Diamond

    Area of a diamond formula

    To generate diamonds with a side length of 100 meters, specify the Size parameter value of 10,000 square meters (100 raised to the power of 2).

    Triangle

    Area of a triangle formula

    To generate triangles with a side length of 100 meters, specify the Size parameter value of 4330.127018922193 square meters (100 raised to the power of 2 multiplied by the square root of 3 divided by 4).

    The Shape Type parameter value's H3 hexagon option ignores the Size parameter. The area of the hexagon will be based on the H3 Resolution parameter value.

    Learn more about H3 resolutions

Parameters

LabelExplanationData Type
Output Feature Class

The path and name of the output feature class containing the tessellated grid.

Feature Class
Extent

The extent that the tessellation will cover. This can be the currently visible area, the extent of a dataset, or manually entered values.

  • Current Display Extent Map View—The extent will be based on the active map or scene. This option is only available when there is an active map.
  • Draw Extent Square and Finish—The extent will be based on a rectangle drawn on the map or scene. This option will create a feature class in the project geodatabase and add a layer to the map. The feature class will have the same coordinate system as the map.
    Note:

    This option is not available in the Environments dialog box. It is only available from a tool parameter with an extent data type or from the Environments tab on a tool dialog box.

    Note:

    When the Enable and disable editing from the Edit tab editing option is checked, you must enable editing on the Edit ribbon tab to draw the extent.

  • Extent of a Layer Layer—The extent will be based on an active map layer. Use the drop-down list to choose an available layer or use the Extent of data in all layers option to get the combined extent of all active map layers, excluding the basemap. This option is only available when there is an active map with layers.

    Each map layer has the following options:

    • All Features Select All—The extent of all features in the layer.
    • Selected Features Area from Selected Features—The extent of the selected features in the layer.
    • Visible Features Extent Indicator—The extent of the visible features in the layer.
      Note:

      The extents from the Selected Features Area from Selected Features and Visible Features Extent Indicator options are only available for feature layers.

  • Browse Browse—The extent will be based on an existing dataset.
  • Clipboard Paste—The extent can be copied to and pasted from the clipboard.
    • Copy Extent Copy—Copies the extent coordinates and coordinate system to the clipboard.
    • Use Paste Extent Paste—Pastes the extent coordinates and, optionally, the coordinate system from the clipboard. If the clipboard values do not include a coordinate system, the extent will use the map’s coordinate system.
    Note:

    The extent coordinates are copied to and pasted from the clipboard using the same formatting and order as the ArcPy Extent object: x-min, y-min, x-max, y-max, and the spatial reference.

  • Reset Extent Reset—The extent will be reset to the default value.
  • Manually entered coordinates—The coordinates must be numeric values and in the active map's coordinate system.
    Caution:

    The map may use different display units than the entered coordinates. The use of a cardinal direction (N, S, E, W) is not supported. Use a negative value sign for south and west coordinates.

Extent
Shape Type
(Optional)

Specifies the shape that will be generated.

  • HexagonHexagon-shaped features will be generated. The top and bottom side of each hexagon will be parallel with the x-axis of the coordinate system (the top and bottom are flat).
  • Transverse hexagonTransverse hexagon-shaped features will be generated. The right and left side of each hexagon will be parallel with the y-axis of the dataset's coordinate system (the top and bottom are pointed).
  • SquareSquare-shaped features will be generated. The top and bottom side of each square will be parallel with the x-axis of the coordinate system, and the right and left sides will be parallel with the y-axis of the coordinate system.
  • DiamondDiamond-shaped features will be generated. The sides of each polygon will be rotated 45 degrees away from the x-axis and y-axis of the coordinate system.
  • TriangleTriangular-shaped features will be generated. Each triangle will be a regular three-sided equilateral polygon.
  • H3 hexagonHexagon-shaped features will be generated based on the H3 Hexagonal hierarchical geospatial indexing system.
String
Size
(Optional)

The area of each individual shape that comprises the tessellation.

Areal Unit
Spatial Reference
(Optional)

The spatial reference to which the output dataset will be projected. If a spatial reference is not provided, the output will be projected to the spatial reference of the input extent. If neither has a spatial reference, the output will be projected in GCS_WGS_1984.

Spatial Reference
H3 Resolution
(Optional)

Specifies the H3 resolution of the hexagons.

With each increasing resolution value, the area of the polygons will be one seventh the size.

  • 0—Hexagons will be created at the H3 resolution of 0, with an average area of 4,357,449.416078381 square kilometers.
  • 1—Hexagons will be created at the H3 resolution of 1, with an average area of 609,788.441794133 square kilometers.
  • 2—Hexagons will be created at the H3 resolution of 2, with an average area of 86,801.780398997 square kilometers.
  • 3—Hexagons will be created at the H3 resolution of 3, with an average area of 12,393.434655088 square kilometers.
  • 4—Hexagons will be created at the H3 resolution of 4, with an average area of 1,770.347654491 square kilometers.
  • 5—Hexagons will be created at the H3 resolution of 5, with an average area of 252.903858182 square kilometers.
  • 6—Hexagons will be created at the H3 resolution of 6, with an average area of 36.129062164 square kilometers.
  • 7—Hexagons will be created at the H3 resolution of 7, with an average area of 5.161293360 square kilometers. This is the default.
  • 8—Hexagons will be created at the H3 resolution of 8, with an average area of 0.737327598 square kilometers.
  • 9—Hexagons will be created at the H3 resolution of 9, with an average area of 0.105332513 square kilometers.
  • 10—Hexagons will be created at the H3 resolution of 10, with an average area of 0.015047502 square kilometers.
  • 11—Hexagons will be created at the H3 resolution of 11, with an average area of 0.002149643 square kilometers.
  • 12—Hexagons will be created at the H3 resolution of 12, with an average area of 0.000307092 square kilometers.
  • 13—Hexagons will be created at the H3 resolution of 13, with an average area of 0.000043870 square kilometers.
  • 14—Hexagons will be created at the H3 resolution of 14, with an average area of 0.000006267 square kilometers.
  • 15—Hexagons will be created at the H3 resolution of 15, with an average area of 0.000000895 square kilometers.

This parameter is active when the Shape Type parameter is set to H3 hexagon.

Long

arcpy.management.GenerateTessellation(Output_Feature_Class, Extent, {Shape_Type}, {Size}, {Spatial_Reference}, {H3_Resolution})
NameExplanationData Type
Output_Feature_Class

The path and name of the output feature class containing the tessellated grid.

Feature Class
Extent

The extent that the tessellation will cover. This can be the currently visible area, the extent of a dataset, or manually entered values.

  • MAXOF—The maximum extent of all inputs will be used.
  • MINOF—The minimum area common to all inputs will be used.
  • DISPLAY—The extent is equal to the visible display.
  • Layer name—The extent of the specified layer will be used.
  • Extent object—The extent of the specified object will be used.
  • Space delimited string of coordinates—The extent of the specified string will be used. Coordinates are expressed in the order of x-min, y-min, x-max, y-max.
Extent
Shape_Type
(Optional)

Specifies the shape that will be generated.

  • HEXAGONHexagon-shaped features will be generated. The top and bottom side of each hexagon will be parallel with the x-axis of the coordinate system (the top and bottom are flat).
  • TRANSVERSE_HEXAGONTransverse hexagon-shaped features will be generated. The right and left side of each hexagon will be parallel with the y-axis of the dataset's coordinate system (the top and bottom are pointed).
  • SQUARESquare-shaped features will be generated. The top and bottom side of each square will be parallel with the x-axis of the coordinate system, and the right and left sides will be parallel with the y-axis of the coordinate system.
  • DIAMONDDiamond-shaped features will be generated. The sides of each polygon will be rotated 45 degrees away from the x-axis and y-axis of the coordinate system.
  • TRIANGLETriangular-shaped features will be generated. Each triangle will be a regular three-sided equilateral polygon.
  • H3_HEXAGONHexagon-shaped features will be generated based on the H3 Hexagonal hierarchical geospatial indexing system.
String
Size
(Optional)

The area of each individual shape that comprises the tessellation.

Areal Unit
Spatial_Reference
(Optional)

The spatial reference to which the output dataset will be projected. If a spatial reference is not provided, the output will be projected to the spatial reference of the input extent. If neither has a spatial reference, the output will be projected in GCS_WGS_1984.

Spatial Reference
H3_Resolution
(Optional)

Specifies the H3 resolution of the hexagons.

With each increasing resolution value, the area of the polygons will be one seventh the size.

  • 0—Hexagons will be created at the H3 resolution of 0, with an average area of 4,357,449.416078381 square kilometers.
  • 1—Hexagons will be created at the H3 resolution of 1, with an average area of 609,788.441794133 square kilometers.
  • 2—Hexagons will be created at the H3 resolution of 2, with an average area of 86,801.780398997 square kilometers.
  • 3—Hexagons will be created at the H3 resolution of 3, with an average area of 12,393.434655088 square kilometers.
  • 4—Hexagons will be created at the H3 resolution of 4, with an average area of 1,770.347654491 square kilometers.
  • 5—Hexagons will be created at the H3 resolution of 5, with an average area of 252.903858182 square kilometers.
  • 6—Hexagons will be created at the H3 resolution of 6, with an average area of 36.129062164 square kilometers.
  • 7—Hexagons will be created at the H3 resolution of 7, with an average area of 5.161293360 square kilometers. This is the default.
  • 8—Hexagons will be created at the H3 resolution of 8, with an average area of 0.737327598 square kilometers.
  • 9—Hexagons will be created at the H3 resolution of 9, with an average area of 0.105332513 square kilometers.
  • 10—Hexagons will be created at the H3 resolution of 10, with an average area of 0.015047502 square kilometers.
  • 11—Hexagons will be created at the H3 resolution of 11, with an average area of 0.002149643 square kilometers.
  • 12—Hexagons will be created at the H3 resolution of 12, with an average area of 0.000307092 square kilometers.
  • 13—Hexagons will be created at the H3 resolution of 13, with an average area of 0.000043870 square kilometers.
  • 14—Hexagons will be created at the H3 resolution of 14, with an average area of 0.000006267 square kilometers.
  • 15—Hexagons will be created at the H3 resolution of 15, with an average area of 0.000000895 square kilometers.

This parameter is enabled when the Shape_Type parameter is set to H3_HEXAGON.

Long

Code sample

GenerateTessellation example 1 (Python window)

The following Python window script demonstrates how to use the GenerateTessellation function in immediate mode.

import arcpy
tessellation_extent = arcpy.Extent(0.0, 0.0, 10.0, 10.0)
spatial_ref = arcpy.SpatialReference(4326)
arcpy.management.GenerateTessellation(r"C:\data\project.gdb\hex_tessellation", 
                                      tessellation_extent, "HEXAGON", 
                                      "100 SquareMiles", spatial_ref)
GenerateTessellation example 2 (Python window)

The following Python window script demonstrates how to use the GenerateTessellation function to create H3 hexagons.

# Import modules
import arcpy

# Create some variables
out_gdb = r"C:\temp\project.gdb\h3_hexagon"
extent = arcpy.Extent(0.0, 0.0, 10.0, 10.0)
sr = arcpy.SpatialReference(4326)

# Generate H3 hexagons
arcpy.management.GenerateTessellation(out_gdb, Extent=extent, Shape_Type="H3_HEXAGON",
                                      H3_Resolution=5, Spatial_Reference=sr)
GenerateTessellation example 3 (stand-alone script)

The following stand-alone Python script demonstrates how to programmatically extract an extent from a feature class and use the extent to fill the parameters of the GenerateTessellation function.

# Name: GenerateDynamicTessellation.py
# Purpose: Generate a grid of squares over the envelope of a provided feature 
# class.

# Import modules
import arcpy 

# Set paths of features
my_feature = r"C:\data\project.gdb\myfeature"
output_feature = r"C:\data\project.gdb\sqtessellation"

# Describe the input feature and extract the extent
description = arcpy.Describe(my_feature)
extent = description.extent

# Find the width, height, and linear unit used by the input feature class' extent
# Divide the width and height value by three.
# Multiply the divided values together and specify an area unit from the linear 
# unit.
# Should result in a 4x4 grid covering the extent. (Not 3x3 since the squares 
# hang over the extent.)
w = extent.width
h = extent.height
u = extent.spatialReference.linearUnitName
area = "{size} Square{unit}s".format(size=w/3 * h/3, unit=u)

# Use the extent's spatial reference to project the output
spatial_ref = extent.spatialReference

arcpy.management.GenerateTessellation(output_feature, extent, "SQUARE", area, 
                                      spatial_ref)

Related topics