在获得 location 对象后,可以用 lng() 函数 lat() 函数获得经度和纬度。
例如下面的方法:townsCoordinatesLongitude = results[0].geometry.location.lng();
townsCoordinatesLatitude = results[0].geometry.location.lat();程序会输出:-71.45478909999997
42.9956397 ![]()
在获得 location 对象后,可以用 lng() 函数 lat() 函数获得经度和纬度。
例如下面的方法:townsCoordinatesLongitude = results[0].geometry.location.lng();
townsCoordinatesLatitude = results[0].geometry.location.lat();程序会输出:-71.45478909999997
42.9956397 ![]()