AnsweredAssumed Answered

What is the quickest way to convert an Envelope to a Polygon?

Question asked by paul.haakma on May 3, 2018
Latest reply on May 4, 2018 by LSmallwood-esristaff

In Runtime 100.x, what is the quickest way to convert an Envelope into a Polygon?


I seem to remember the old runtime had a method on an Envelope something like myEnv.toPolygon(), nice and easy. Now I have use a PolygonBuilder I assume? And I can't just set the geometry of it to an existing Envelope object as it doesn't seem to accept it.

An Envelope doesn't seem to have a PointCollection, so I can't even add from that. All it seems to have are xMax, xMin etc. Do I really have to cycle through and construct four points and add them one by one to the PolygonBuilder?


A way I found was to use GeometryEngine.buffer(myEnv, 0)  but that seems a bit hacky. It works, I'm just wondering if I'm missing some other simple way.