1

I'm Using wiki mapia api to get the geo information. Wiki Mapia

http://api.wikimapia.org/?key=example&function=place.getnearest&lat=12.9605459&lon=77.5649618&count=50&format=json&category=15417.

this api returning, location name lat,lng,min lat lng, max lat lng , polygon. Like that i need polygon area. anyone used this api kindly suggest me how to get the area parameter .

mindriot
  • 5,413
  • 1
  • 25
  • 34
varun kumar
  • 101
  • 2
  • 10

1 Answers1

1

Without using the api, and only using the points returned by the api you may apply the following algorithm (specified here in pseudocode):

function polygonArea(X, Y, numPoints) 
{ 
    area = 0;         // Accumulates area 
    j = numPoints-1;  // The last vertex is the previous one to first

    for (i=0; i<numPoints; i++)
    { 
        area = area +  (X[j]+X[i]) * (Y[j]-Y[i]); 
        j = i;  //j is previous vertex to i
    }
    return area/2;
}
INDIA IT TECH
  • 1,902
  • 4
  • 12
  • 25
Felipe Sulser
  • 1,185
  • 8
  • 19