Google地图API地理编码同步 [英] Google Maps API Geocode Synchronously

查看:144
本文介绍了Google地图API地理编码同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以使用googlemaps API同步地进行地理编码,而不是等待回调函数被调用,而是等待返回值。有没有人找到一种方法来做这样的事情。

I was wondering if its possible to geocode something using googlemaps api synchronously so instead of waiting for a callback function to be called, it would wait for a value to be returned. Has anyone found a way to do something like this.

PS:我正在使用api的第3版

P.S.: I'm using version 3 of the api

推荐答案

Geocoder使用该值调用您的回调函数。这是做到这一点的唯一方法。如果它是同步的,那么脚本会在等待Geocode处理时冻结。真的没有理由这样做。

The Geocoder calls your callback function with the value. That's the only way to do it. If it were synchronous, your script would freeze while it waited for the Geocode to process. There really isn't any reason to do it like that.

你究竟想要完成什么?

这篇关于Google地图API地理编码同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆