Use Google Colaboratory
Geocoder https://qiita.com/yoshi_yast/items/bb75d8fceb712f1f49d1 See
pydams Details below https://github.com/hottolink/pydams http://newspat.csis.u-tokyo.ac.jp/geocode/modules/dams/index.php?content_id=2 https://www.hottolink.co.jp/blog/20180823_98734/
!wget http://newspat.csis.u-tokyo.ac.jp/download/dams-4.3.4.tgz
!tar -xzvf dams-4.3.4.tgz
!git clone https://github.com/hottolink/pydams.git
!patch -d ./dams-4.3.4 -p1 < ./pydams/patch/dams-4.3.4.diff
%cd dams-4.3.4
!./configure; make
!make install
!ldconfig
!ldconfig -v | grep dams
!ldconfig -v | grep dams
!make dic
!make install-dic
%cd ../
![ ! -d 'pydams' ] && git clone https://github.com/hottolink/pydams.git
%cd pydams
!make all
!make install
!pip freeze | grep pydams
#Execution result
#pydams==1.0.4
from pydams import DAMS
from pydams.helpers import pretty_print
DAMS.init_dams()
address = u"4-2-8 Shibakoen, Minato-ku, Tokyo"
# geocode() method
geocoded = DAMS.geocode(address)
pretty_print(geocoded)
# geocode_simplify() method
geocoded = DAMS.geocode_simplify(address)
pretty_print(geocoded)
"""Execution result
score: 5
candidates: 1
candidate: 0, address level: 7
address:Tokyo, lat:35.68949890136719, long:139.69163513183594
address:Minato-ku, lat:35.65850067138672, long:139.75155639648438
address:Shiba Park, lat:35.65782928466797, long:139.75172424316406
address:4-chome, lat:35.65620422363281, long:139.7484588623047
address:No. 2, lat:35.658538818359375, long:139.74542236328125
score: 5
candidates: 1
candidate: 0, address level: 7
address:4-2 Shibakoen, Minato-ku, Tokyo, lat:35.658538818359375, long:139.74542236328125
"""
def GEOCODE(address):
DAMS.init_dams()
# geocode() method
geocoded = DAMS.geocode_simplify(address)
res = geocoded['candidates'][0]
return [res['y'], res['x']]
print(GEOCODE('4-2-8 Shibakoen, Minato-ku, Tokyo'))
#[35.658538818359375, 139.74542236328125]