Skip to content

Instantly share code, notes, and snippets.

@avances123
Created October 1, 2016 09:53
Show Gist options
  • Save avances123/d954fac92ffea2ffcec55aa53fbf0ee0 to your computer and use it in GitHub Desktop.
Save avances123/d954fac92ffea2ffcec55aa53fbf0ee0 to your computer and use it in GitHub Desktop.
{
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"<[OK] Google - Reverse [Unnamed Road, 44422 Abejuela, Teruel, Spain]>"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import geocoder\n",
"house = geocoder.google([39.93328, -0.86911],method='reverse')\n",
"house"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"'Abejuela'"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# For LOCATION_CITY\n",
"house.city"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Teruel\n",
"44422\n"
]
}
],
"source": [
"# For LOCATION_SECTOR ?\n",
"print(house.county)\n",
"# Or\n",
"print(house.postal)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"'Aragón'"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# For LOCATION_STATE\n",
"house.state"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"'Unnamed Road'"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# For LOCATION_STREET\n",
"house.street"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment