如何将纬度和经度(从gps方法)转换为几何图形.location谷歌地图对象

How to convert latitude and longitude (from gps methods) to a geometry.location Google maps object

本文关键字:转换 几何图形 location 对象 谷歌地图 方法 gps 纬度 经度      更新时间:2023-09-26

我必须在谷歌地图上计算出一些坐标,我需要将46.1241241,11.223235(通过GPS,通过position.coords)这样的坐标转换为geometry.location谷歌地图API 3对象。

我该怎么做?

下面是创建坐标的方法:

var p1 = new google.maps.LatLng(45.463688, 9.18814);
var p2 = new google.maps.LatLng(46.0438317, 9.75936230000002);