Python-network-programming-python-google-maps

提供:Dev Guides
移動先:案内検索

Python-Googleマップ

Pythonは、Googleマップで利用可能な住所を地理座標に直接変換するために使用できるモジュールを提供します。 ビジネスの住所を見つけ、異なる住所の近さを見つけるのに役立ちます。

アドレスとジオコードを受信する機能を提供する pygeocoder という名前のモジュールを使用します。 このモジュールは、次のコマンドを使用してpipを介してインストールされます。

pygeocoderのインストール

pip install pygeocoder

住所の検索

入力としてビジネス名を送信すると、プログラムは出力として完全な住所を提供します。 このモジュールは、バックグラウンドでGoogleマップのデータを使用して結果を取得します。

from pygeocoder import Geocoder

business_name = "Workafella Business Centre - Hitec city"
print "Searching %s" %business_name
results = Geocoder.geocode(business_name)
for result in results:
    print result

上記のプログラムを実行すると、次の出力が得られます-

Searching Workafella Business Centre - Hitec city
Western pearl building 1st floor, Hitech City Rd,
Opposite HDFC Bank, Kondapur, Hyderabad, Telangana 500084, India