2016-04-06 15 views
0

Ich benutze Wiki mapia api, um die Geo-Informationen zu erhalten. Wiki MapiaWie bekomme ich die Fläche der Polygone von wiki mapia api

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

Diese API zurück, Ortsname lat, lng, min lat lng, max lat lng, Polygon. So brauche ich Polygonfläche. jemand, der diese API verwendet, schlägt mir freundlicherweise vor, wie man den Bereichsparameter bekommt.

Antwort

0

Ohne die api zu verwenden und nur mit den von der api zurück Punkte, die Sie den folgenden Algorithmus anwenden kann (hier angegebene in Pseudo-Code):

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; 
}