简体   繁体   English

如何使用Google Maps JavaScript API v3获取谷歌地图中所查看区域中心的坐标

[英]how to get coordinates of the center of the viewed area in google maps using Google Maps JavaScript API v3

How to get coordinates using javascript Google Maps JavaScript API v3 of the center of the currently viewed area on google maps? 如何使用google地图上当前查看区域中心的javascript Google Maps JavaScript API v3获取坐标? Thanks 谢谢

You can call: 你可以打电话:

map.getCenter();

to return a LatLng object. 返回一个LatLng对象。

Updated 2018 The below codes are for Google Maps API for Android. 更新时间2018以下代码适用于Android版Google Maps API。 In case anyone needs this Script: 如果有人需要这个脚本:

double mylat = mGoogleMap.getCameraPosition().target.latitude;               
double mylon = mGoogleMap.getCameraPosition().target.longitude;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM