ジオコーディング

□未翻訳

□翻訳中

□翻訳完了(Yota Ichino)

■レビュー(Omi Chiba)

ジオコーディング

もし、住所(例: "243 S Wabash Ave, Chicago, IL, USA")を地理座標(緯度と経度)に変換する必要があるなら、web2pyはそのように動作する関数を提供します。

If you need to convert an address (for example: "243 S Wabash Ave, Chicago, IL, USA") into geographical coordinates (latitude and longitude), web2py provides a function to do so.

1.

2.

3.

from gluon.tools import geocode

address = '243 S Wabash Ave, Chicago, IL, USA'

(latitude, longitude) = geocode(address)

geocode関数はネットワーク接続が必要で、ジオコーディング用の Google geocodingサービスに接続します。関数は失敗した場合に(0,0)を返却します。Google geocodingサービスはリクエスト回数に上限を定めることに注意し、あなたはそれらのサービス同意書を確認すべきです。geocode関数はfetch関数上で実装されているためGAEでも動作します。

The function geocode requires a network connection and it connects to the Google geocoding service for the geocoding. The function returns (0,0) in case of failure. Notice that the Google geocoding service caps the number of requests, so you should check their service agreement. The geocode function is built on top of the fetch function and thus it works on GAE.