Select to view content in your preferred language

Return extent polygon as polygon, not multipolygon

577
0
01-09-2023 09:42 AM
Status: Open
EricEagle
Occasional Contributor III

When getting a single extent, the polygon property returns the object as a multipolygon rather than a polygon.  Extents are simple geometry consisting of 5 points (4 + origin to close).  They are not complex geometry and do not need to be returned as multipolygons.  However, when I do something like this:

p = arcpy.mp.ArcGISProject("CURRENT")
wkt = p.activeView.camera.getExtent().polygon.WKT

it returns, somewhat oddly:

MULTIPOLYGON (((0 0, 1 0, 1 1, 0 1, 0 0)))

When what ought to be returned should be in the format (notice, no spaces between the primitive and the double open-parentheses):

POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))

 

Generally I just use regex to fix this but my OCD finally forced me to request this as an Idea...hopefully a simple fix, thanks!

Tags (3)