Error when using arcpy.GenerateTessellation_management in ArcGIS Pro 2.6 with arcpy Python

1063
8
12-16-2020 09:12 AM
Romero_Dario
New Contributor II
sdf = pd.DataFrame.spatial.from_featureclass(os.path.join(gdb_file, gdb_layers[1]))
sdf.head()
# Describe the input feature and extract the extent
description = arcpy.Describe(os.path.join(gdb_file, gdb_layers[1]))
extent = description.extent
tessellation_extent = sdf.spatial.full_extent
spatial_ref = extent.spatialReference

I am trying to generate a Feature Class with hexagons by using the method GenerateTessellation_management with this code:

 

arcpy.GenerateTessellation_management(Output_Feature_Class=gdb_file+r"\hex_tessellation", 
                                      Extent=tessellation_extent, 
                                      Shape_Type="HEXAGON",
                                      Size="1000000 Square Foot",
                                      Spatial_Reference=spatial_ref
                                     )

 

And I am getting this error:

Romero_Dario_0-1608138311590.png

 

I am following the documentation as per the following website:

https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/generatetesellation.htm

Any idea why this is not working?

Thanks in advanced.

Dario

 

0 Kudos
8 Replies
DanPatterson
MVP Esteemed Contributor

from here

Generate Tessellation (Data Management)—ArcGIS Pro | Documentation

w = extent.width
h = extent.height
u = extent.spatialReference.linearUnitName
area = "{size} Square{unit}s".format(size=w/3 * h/3, unit=u)

 

have you confirmed setting the area unit? I looks like a different configuration is expected than what you have shown


... sort of retired...
0 Kudos
Romero_Dario
New Contributor II

Thanks for your reply.

Actually the Feature Class in on a shape that is on Degrees. I might use the area as:

w = extent.width
h = extent.height
u = extent.spatialReference.angularUnitName
w, h, u
(359.999999902, 179.491346668, 'Degree')
area = "{size} Square{unit}s".format(size=w/3 * h/3, unit=u)
area
'7179.653864765539 SquareDegrees'

 but got the same error. Do you have any other suggestion.

Thanks.

0 Kudos
DanPatterson
MVP Esteemed Contributor

That is a horrendously large area and I suspect a reason that you might be having issues


... sort of retired...
0 Kudos
Romero_Dario
New Contributor II

I've changed it to be the area of equal size hexagons where the formula for the area is:

Romero_Dario_0-1608161246300.png

there I added this equation to have hexagon of 5 degrees each, consequently:

area = "{size} Square{unit}s".format(size=((3.0*math.sqrt(3.0))/2.0)*(a**2.0), unit=u)
area
'64.9519052838329 SquareDegrees'
... then the result is again the same error. Can this function deal with geographical coordinates rather than linear (like UTM)?
# Use the extent's spatial reference to project the output
spatial_ref = extent.spatialReference
spatial_ref

Romero_Dario_1-1608161553894.png

 

0 Kudos
DanPatterson
MVP Esteemed Contributor

No.... If neither has a spatial reference, the output is projected in GCS_WGS_1984. from the help, But do you really want approx 8 degree by 8 degree hexagons?  How big an area are you trying to produce a hexagonal grid pattern for?  It wouldn't take many hexagons to cover north america.

On the side note, If you are not working on the continental or global scale, I would use a projected coordinate system.  UTM, albers, whatever... at least the lengths of the sides of the hexagon will be planar and equal(ish) far moreso than degrees.  There is no indication whether the hexagon sides are generate as geodesic shapes


... sort of retired...
0 Kudos
Romero_Dario
New Contributor II

I am working on a global scale. Ideally the hexagon(s) should be 0.1 degrees on the side. Although I think the problem might be in the spatial reference. Don't you think.

0 Kudos
Romero_Dario
New Contributor II

... another idea would be to convert the layer to an Equal-area projection, run the procedure. And see what happen.

0 Kudos
DanPatterson
MVP Esteemed Contributor

0.1 degrees squared would be the area of each hexagon, not 5 degrees... that might be your full extent.

Just try something much smaller and check the coordinate system you want to use eg GCS WGS84 if you must work in degrees


... sort of retired...
0 Kudos