deniscarriere / geocoder Goto Github PK
View Code? Open in Web Editor NEW:earth_asia: Python Geocoder
Home Page: http://geocoder.readthedocs.org
License: MIT License
:earth_asia: Python Geocoder
Home Page: http://geocoder.readthedocs.org
License: MIT License
Example of urllib2 for requests connection
import urllib2
import urllib
import json
import pprint
# Use the json module to dump a dictionary to a string for posting.
data_string = urllib.quote(json.dumps({'id': 'data-explorer'}))
# Make the HTTP request.
response = urllib2.urlopen('http://demo.ckan.org/api/3/action/group_list',
data_string)
assert response.code == 200
# Use the json module to load CKAN's response into a dictionary.
response_dict = json.loads(response.read())
# Check the contents of the response.
assert response_dict['success'] is True
result = response_dict['result']
pprint.pprint(result)
Change the geocoder.maxmind() to geocoder.ip()
g = geocoder.elevation('Ottawa')
It was working earlier today, then it stopped and is returning None for all values. Is there a limit to the number of queries? I have a list of 60 IP's that geocoded just fine, and returned an address for all 60. Now attempting it with the same 60, it does not work.
If I try to use the URL in ip.py directly, it requires credentials.Did maxmind change something?
g = geocoder.google()
g.name
"Geocoder"
Must be changed to the actual Source's name like Google or Bing, etc...
g = geocoder.driving('Ottawa','Toronto')
Not a feature that is essential in this type of task
would be nice to have
g = geocoder.google('Ottawa, ON')
g.json
into a Dict()
{
"address": "Ottawa, ON, Canada",
"bbox": [
[
44.962733,
-76.353916
],
[
45.53758,
-75.24659799999999
]
],
"east": -75.24659799999999,
"geocoder": "Google",
"latlng": [
45.4215296,
-75.69719309999999
],
"north": 45.53758,
"ok": true,
"quality": "APPROXIMATE",
"south": 44.962733,
"status": "OK",
"west": -76.353916,
"x": -75.69719309999999,
"y": 45.4215296
}
places = geocoder.places('Kabul, Afghanistan', keyword='Embassy')
for place in places:
print place
g = geocoder.timezone('Ottawa')
g.zone
g.offset
g.name
g.json
geocoder.get()
geocoder.get(, provider='google', proxies='')
I want to geocode to clean up addresses, as well as get latitude and longitude. It looks like geocoder does not actually give the entire Google result.
For example
Use XML minidom instead
g = geocoder.google('ottawa')
g.latlng
g = geocoder.google('ottawa')
BREAK ***
d = geocoder.distance('Ottawa', 'Toronto')
d.miles
d.km
d.meters
d.feet
d.json
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.