1

MapView に追加された MKPolygonView オブジェクトの領域を見つけようとしています。Apple のドキュメントには、MKPolygonView オブジェクトのエッジ間の距離を見つけるための distanceFromLocation: メソッドがあります。しかし、オーバーレイの面積を計算するものは見つかりませんでした。

Apple には、領域を見つけるための文書化された方法がありますか?

4

1 に答える 1

0

Concerning the comments on the question post, the Earth is not a perfect sphere either. In fact, it's not a perfect anything, so "correct" answers aren't possible. What matters is how accurate of an approximation you need. Also, are you interested in a mean sea level type measurement, or do you want the actual contours of the ground (for example if your polygon is put over a mountain, then the same exact size polygon is put over some plains, should the result you calculate be the same or different)?

Depending on how big your polygon is, and which measurement you're looking for, a 2D approximation can be pretty accurate (the smaller the polygon, the closer you'll get). Something to keep in mind, if you want your area in something like square feet, the distance between two longitudinal lines is not constant (63 deg west and 62 deg west are closer (in feet) somewhere in Alaska than they are at the equator). You might have to do a unit conversion to handle this depending on how big your polygon is (or if your polygon could be placed anywhere). If you can't do the 2D approximation, I'm not even sure how you'd do that.

When I did this, I did the 2D approx, and I had to do the unit conversion. If that's the way you go, I can try to dig up some of my old notes and the links I used to get you started.

于 2012-09-14T14:10:27.493 に答える