iOSアプリ上のGoogleMapで図形を描画し、そのパス内部の面積を計測することができます。
まずは図形を描画します。
// Create a rectangular path
let rect = GMSMutablePath()
rect.add(CLLocationCoordinate2D(latitude: 37.36, longitude: -122.0))
rect.add(CLLocationCoordinate2D(latitude: 37.45, longitude: -122.0))
rect.add(CLLocationCoordinate2D(latitude: 37.45, longitude: -122.2))
rect.add(CLLocationCoordinate2D(latitude: 37.36, longitude: -122.2))
// Create the polygon, and assign it to the map.
let polygon = GMSPolygon(path: rect)
polygon.fillColor = UIColor(red: 0.25, green: 0, blue: 0, alpha: 0.05);
polygon.strokeColor = .black
polygon.strokeWidth = 2
polygon.map = mapView
面積を計測
let a: Double = GMSGeometryArea(polygon.path!)
JavaScriptのAPIではパスが閉じている必要がありましたが、
こちらは閉じていなくても閉じているものと仮定してくれるようです。
ただ、実際に使ってみた結果、JavaScript APIのほうで測った面積と24m²ほど差がありました。
JavaScriptでの計測はこちら→GoogleMapで面積計測(v3)
Xcode: 9.4.1
Swift: 3.3
OS: High Sierra 10.13.6