I have a Silverlight application with a Bing Map control that displays a series of editable MapPolygons that the user can resize at will. These MapPolygons are, of course, defined as geographic coordinates. How do I calculate the area of a polygon?
The polygons are stored as geography types in SQL Server and I could go back to the server for the answer, but then the user loses an interactive update of the area as they reshape the polygons. Accuracy to within a few percent is desirable.
I solved this by writing a routine to do 'spherical geometry' area calculations on the client. Works a treat and no need to go back to the server.
In short, I cheat. I find the centroid of the area, flatten to a plane centered on the centroid, and use plane geometry to do the polygon area calculation by treating the polygon as a series of triangles.
Although it's an approximation it's quite accurate enough for my purposes. If I needed an exact answer I would use SCHUMMBOs method.
Dave.