Quantcast
Channel: DotSpatial
Viewing all articles
Browse latest Browse all 3973

New Post: Polygon.Area - what are the units?

$
0
0
I'm not sure if this is the most "correct" way of doing it, but I calculated the area of a shape in Lat/Long using the code below. First I may an array of X/Y coordinates in the shape, then multiplied each one by .017453293 (0.017453293 converts degrees to radians: 2pi/360). Then I looped through each of the point to find the area

'm-2 because the starting point must be the same as the ending point
For j = 0 To numpoints - 2
 Area = Area + ((X(j + 1)) - (X(j))) * ((Math.Sin(Y(j))) + (Math.Sin(Y(j + 1))))
Next

Then to chose which unit I wanted to display the area

'Example for Feet
AreaFt = Math.Abs(Area * 6378137 * 6378137 / 2) * 10.76391041671

This got me pretty close to the correct area, even though it is not absolutely exact.

Viewing all articles
Browse latest Browse all 3973

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>