I have the following line of code:
this.centerPoint = this.graphic.geometry.getCentroid();
When I run the program and step through the code, the value of geometry.rings is:
[-81.63820933449949,32.72321758156744,-81.6381280506363,32.72321758156744,-81.6381280506363,32.723341259885146,-81.63820933449949,32.723341259885146,-81.63820933449949,32.72321758156744]
But when I examine the X and Y values of the resultant centerpoint variable, they look opposite from what I would expect:
X = 81.6392691466801
Y = -32.7237205172898
Which would move the geometry from the southeastern U.S. to somewhere in the Indian ocean. Obviously I'm doing something wrong. Any guesses?
Solved! Go to Solution.
Well, it seems that reversing the order of the points broke some other things in the app. It seems some of the shapes we draw were not happy with being reversed. Back to the drawing board.
OK. So the solution turned out to be fairly simple. Rather than changing the rotation of the graphic before adding it to the map, I simply check the rotation of the graphic selected by the click event and then reverse it's rotation if needed before getting the centroid. This way I don't affect all the graphics on the map - just the one I'm interested in.
But now I have a different problem going on. I'll start a new thread to address it.