I am trying to render a rectangle graphics box onto the map, given the center location of an polygonal feature and the extent dimensions (length and width) in meters. The feature has the spatial reference of its shape set to WGS84 though.

I am able to get the location of the feature (an IPoint) by taking its centroid. Is there then a straightforward way to accomplish the drawing of such a box with meter-dimensions around that point?

Looking at the API, IEnvelope seems to be what I need, but will I have issues with unit-conversions (since I need the extent dimensions to be in meters)? And how should I go about rendering the IEnvelope?

Any help is appreciated, thanks!

closed as off-topic by ahmadhanb, Midavalo Dec 4 '17 at 5:33

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking help to debug/write/improve code must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Providing a clear problem statement and evidence of a code attempt will help others to help you. See: How to create a Minimal, Complete, and Verifiable example." – ahmadhanb, Midavalo
If this question can be reworded to fit the rules in the help center, please edit the question.

  • This should be pretty simple given the right interfaces, but I'm not sure of the best approach. Do you want the graphic to persist or do you just want it to flash on the screen momentarily? – blah238 Oct 9 '12 at 17:23
  • 1
    In a geographic coordinate system, the "envelope" will actually be a polygon with curved segments. I guess IConstructGeodetic could be of help. – Petr Krebs Oct 9 '12 at 18:42
  • 1
    If you do not want the edges to be curved, you could construct a geodesic ellipse (IConstructGeodetic.ConstructGeodesicEllipse) around the point with the semi-major and semi-minor axes corresponding to the half of the width and length, respectively, then get an envelope of that geometry. – Petr Krebs Oct 9 '12 at 18:50
  • 1
    If your data frame can be rotated you might also consider the need to rotate the envelope before displaying it as a graphic. – blah238 Oct 9 '12 at 19:48
  • Thanks @blah238 and Petr. Yes I would want the graphic to persist as an IElement, and I don't want the edges to be curved. I'll try out the Geodesic Ellipse. I am unsure about the semi-major azimuth parameter though. Any idea what this should be? – Ken Toh Oct 10 '12 at 0:57