Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/435.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 将LatLng(computeoffset()的返回值)转换为对象文字_Javascript_Google Maps_Geometry - Fatal编程技术网

Javascript 将LatLng(computeoffset()的返回值)转换为对象文字

Javascript 将LatLng(computeoffset()的返回值)转换为对象文字,javascript,google-maps,geometry,Javascript,Google Maps,Geometry,computeoffset返回的值是(…,…)。那么如何将其转换为{lat:…,lng:…}?A有纬度和经度的方法: var point = new google.maps.LatLng(10.398671, -84.170756); google.maps.geometry.spherical.computeOffset(point, 100, 0); 根据,返回结果也是类型LatLng。。。 var point = new google.maps.LatLng(10.398671,

computeoffset
返回的值是(…,…)。那么如何将其转换为{lat:…,lng:…}?

A有纬度和经度的方法:

var point = new google.maps.LatLng(10.398671, -84.170756);   
 google.maps.geometry.spherical.computeOffset(point, 100, 0);
根据,返回结果也是类型
LatLng
。。。
var point = new google.maps.LatLng(10.398671, -84.170756);   
var newpt = google.maps.geometry.spherical.computeOffset(point, 100, 0);
var pt = {lat: newpt.lat(), lng: newpt.lng()};