GithubHelp home page GithubHelp logo

dwillis / geocoders Goto Github PK

View Code? Open in Web Editor NEW

This project forked from simonw/geocoders

7.0 3.0 1.0 82 KB

Ultra simple API for geocoding a single string against various web services.

License: BSD 2-Clause "Simplified" License

Python 100.00%

geocoders's Introduction

Geocoders
=========

Code for accessing various geocoding web services with an ultra simple API:

    name, (lon, lat) = geocode('london')

The geocode functions return (unicode_place_name, (float_lon, float_lat)) if
the string can be geocoded, and (None, (None, None)) if it cannot. The ordering
of the coordinates makes it possible to pass them directly to a Point object in
GeoDjango (using the GEOS API):

>>> from django.contrib.gis.geos import *
>>> from geocoders.google import geocoder
>>> geocode = geocoder('GOOGLE-API-KEY')
>>> results = geocode('new york')
(u'New York, NY, USA', (-73.986951000000005, 40.756053999999999))
>>> pnt = Point(results[1])

Currently supported: Google Geocoder, Yahoo! Geocoder, Yahoo! Placemaker,
GeoNames and Multimap.

Google:

>>> from geocoders.google import geocoder
>>> geocode = geocoder('GOOGLE-API-KEY')
>>> geocode('new york')
(u'New York, NY, USA', (-73.986951000000005, 40.756053999999999))
>>> geocode('oneuth')
(u'South, Bloomfield, NY 14469, USA', (-77.5385449999999, 42.865267000000003))

Yahoo!:

>>> from geocoders.yahoo import geocoder
>>> geocode = geocoder('YAHOO-API-KEY')
>>> geocode('new york')
(u'New York, NY, US', (-74.007124000000005, 40.714550000000003))
>>> geocode('oneuth')
(u'Aneth, UT 84510, US', (-109.189911, 37.217799999999997))

Yahoo! Placemaker:

>>> from geocoders.placemaker import geocoder
>>> geocode = geocoder('YAHOO-API-KEY')
>>> geocode('new york')
(u'New York, NY, US', (-74.007099999999994, 40.714500000000001))
>>> geocode('oneuth')
(None, (None, None))

While Yahoo! Placemaker isn't strictly designed as a geocoder, in practice it
can be useful for things like "did you mean location X" in a regular search
engine.

GeoNames:

>>> from geocoders.geonames import geocoder
>>> geocode('new york')
(u'New York', (-74.005972900000003, 40.714269100000003))
>>> geocode('oneuth')
(None, (None, None))

Multimap:

>>> from geocoders.multimap import geocoder
>>> geocode = geocoder('MULTIMAP-API-KEY')
>>> geocode('new york')
('New York, State of New York, United States', ('-75.49990', '43.00035'))
>>> geocode('oneuth')
('Omeath, Louth', ('-6.26070', '54.08790'))

geocoders's People

Contributors

jacobian avatar richardkeen avatar

Stargazers

Thomas Roberts avatar JT5D avatar Bryan Bishop avatar Tyler Erickson avatar G Maldonado avatar Dave Stanton avatar Derek Willis avatar

Watchers

Derek Willis avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.