GoogleMaps Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
GMSGeometryDistance
extern CLLocationDistance GMSGeometryDistance(CLLocationCoordinate2D from,
CLLocationCoordinate2D to)
Returns the great circle distance between two coordinates, in meters, on Earth.
This is the shortest distance between the two coordinates on the sphere.
Both coordinates must be valid.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-27 UTC.
[null,null,["Last updated 2025-08-27 UTC."],[[["\u003cp\u003e\u003ccode\u003eGMSGeometryDistance\u003c/code\u003e calculates the shortest distance (great-circle distance) between two coordinates on Earth.\u003c/p\u003e\n"],["\u003cp\u003eThe function takes two \u003ccode\u003eCLLocationCoordinate2D\u003c/code\u003e arguments representing the starting and ending points.\u003c/p\u003e\n"],["\u003cp\u003eThe returned distance is measured in meters.\u003c/p\u003e\n"],["\u003cp\u003eBoth input coordinates must be valid for the function to work correctly.\u003c/p\u003e\n"]]],[],null,["# GoogleMaps Framework Reference\n\nGMSGeometryDistance\n===================\n\n extern CLLocationDistance GMSGeometryDistance(CLLocationCoordinate2D from,\n CLLocationCoordinate2D to)\n\nReturns the great circle distance between two coordinates, in meters, on Earth.\n\nThis is the shortest distance between the two coordinates on the sphere.\n\nBoth coordinates must be valid."]]