Area of Polygon(non-self-intersecting) using lat/long as vertices RRS feed

  • Question

  • hi,

    can i calculate the area of polygon using below formula if i have vertices of polygon in the the form of Latitude/Longitude..not in the form of x,y...

    Area =1/2((X0*Y1 -X1Y0)+........................+(Xn-1*Y0 -X0*Yn-1))

    i think it is wrong...because multiplication of angular distance is happening here?????

    Thanks & Regards

    Prakash Kumar

    Saturday, August 25, 2012 10:09 AM


All replies

  • Area of a polygon on a sphere are complex. Take a look at this PDF with calculations: http://trs-new.jpl.nasa.gov/dspace/bitstream/2014/40409/1/07-03.pdf


    Saturday, August 25, 2012 4:32 PM
  • Thanks Richard
    Monday, August 27, 2012 4:07 AM
  • Hi Richard,

    my requirement was find area and perimeter of polygon drawn by user on the map.

    so i m trying to draw non-self-intersecting polygon doesn't matter where user clicks with help of below Algorithm i have created it is working fine. i think it will be helpful to others also.and then after it is easy to calculate Area and Perimeter of Polygon.

    Algorithm : Create Non-self Intersecting Polygon.

    1.    Get the Location(s) in a LocationCollection  as polygonVertices and next Location to be added in polygon and newLocation.
    2.    If(polygonVertices.count > 2) start loop.
    3.    Sort the location(s) in the polygonVertices according to Latitude value(s) into Descending order.
    4.    Set  the FirstLocation = 1st Location in the list . i.e. Location having Highest Latitude value.
    5.    Set the  SecondLocation=2nd Location in the list. i.e. Location having Lowest Latitude value.
    6.    Now check that newLocation is on which side of line use Determinant method i.e. +ve/-ve value(s) tells that either side of line.
    7.    Note: take the variables LocationCollection -> LeftsideVertices , RightSideVertices.                Start loop foreach(Location item in polygonVertices)
    Determine the value of matrix like below                                                                                       matrixvalue = (((FirstLocation.Longitude -  SecondLocation.Longitude) * (item.Latitude - SecondLocation.Latitude))- ((FirstLocation.Latitude - SecondLocation.Latitude) * (item.Longitude - SecondLocation.Longitude)));

     If(matrixvalue > 0)
    7.1.1    Add newLocation i.e. item into LeftsideVertices
    7.1.2    Sort  LeftsideVertices LocationCollection.
    7.1.3    If(matrixvalue < 0) Add newLocation i.e. item into RightSideVertices
    7.1.4    Sort  RightSideVertices LocationCollection.    
    8.    Create polygon Object as currentPlogon
    8.1 currentPlogon.Locations.Add(FirstLocation);

                   8.2      foreach (Location item in RightSideVertices.Reverse())

                  8.3       foreach (Location item in LeftsideVertices)

                           8.4    currentPlogon.Locations.Add(FirstLocation);

    9.    Add  currentPlogon  object to childLayer of MapLayer Object.



    Tuesday, October 16, 2012 6:27 AM