Commits

Xiao Yu  committed 79cb3a8

ready release, no test

  • Participants
  • Parent commits cc85aa2
  • Tags 1.0

Comments (0)

Files changed (4)

-recursive-include doc/html *
-prune doc/html/.doctrees/
-exclude doc/html/.buildinfo
-include LICENSE.txt
-include AGPLv3.txt
+include LICENSE.txt
-googlemaps 1.0.2
-16 Oct 2009
+================================================================
+pygeocoder 1.0
+----------------------------------------------------------------
+Xiao Yu
+19/12/2010
+
+based on googlemaps 1.0.2 by John Kleint
+================================================================
+
 README
-=================
+------------
 
-This is a Python 2 module that provides access to the Google Maps and Local 
-Search AJAX APIs.  It has the following features:
+This is a Python wrapper for Google Geocoding API V3
 
-* Geocoding: convert a postal address to latitude and longitude
-* Reverse Geocoding: convert a latitude and longitude to a postal address
-* Driving Directions: turn-by-turn instructions for getting from one point to 
-  another, distance and duration of travel
-* Local Search: find businesses and other points of interest near a given 
-  location  
-
-You will need a Google Maps API key and/or URL of the website where the
-information will be used (a referrer URL) to comply with Google's terms
-of service.  Google also imposes additional restrictions on their
-service, including limiting the number of queries per day.  This 
-software is not related to Google Inc. in any way.  See the included HTML 
-documentation in doc/html or the interactive help for more.
+It allows you to directly convert an address to coordinates or vice versa. 
 
 
 Dependencies
 ------------
-This module should work with Python 2.3 - 2.6+, and with Python 3+ via 2to3.
 Its only dependency is the json module, included with Python versions 2.6 and
 later and available for download as simplejson for earlier versions.
+It is developed on Python 2.7 but should work on earlier versions
 
 
 Installation
 ------------
-You can install this package with easy_install using:
+You can install this package using pip:
 
-    easy_install googlemaps
-    
-Or if you have already downloaded the .tar.gz archive:
+	sudo pip install pygeocoder
+	
+or download the source from http://code.xster.net/pygeocoder and install
+	
+	python setup.py install
 
-    tar xzvf googlemaps-1.0.2.tar.gz
-    cd googlemaps-1.0.2
-    python setup.py install
+Usage
+-----------
+Please refer to http://code.xster.net/pygeocoder/wiki for help with usage
 
 
 Contact Information
 -------------------
-Author: John Kleint
-Internet: http://py-googlemaps.sourceforge.net
-E-mail: py-googlemaps-general@lists.sourceforge.net
+Author: Xiao Yu
+Internet: http://code.xster.net/pygeocoder
 
-
-Copyright and Licensing
------------------------
-This is free software, Copyright 2009 John Kleint, licensed under what is
-effectively a "Lesser Affero General Public License."  It is identical to
-the GNU LGPLv3 but refers to the GNU Affero GPL v3 instead of the standard
-GNU GPL v3.  
-
-In plain English, the intent of this license is the following:
-
-1. You are free to use this library unmodified, without obligation, for any 
-purpose.
-
-2. If you modify this library and distribute software using the modified
-library, you must make your modified version of this library freely available 
-under the same terms as this library.  
-
-3. If you modify this library and use it to provide a network service,
-you must make your modified version of this library freely available under 
-the same terms as this library.  
-
-4. In any case, software using this library can be licensed however you like.
-
-See the files LICENSE.txt and AGPLv3.txt for details.
+For comments, issues, requests, please contact via bitbucket at the above website
 
 
 Changelog
 ---------
-Version 1.0.2:
-Refactored GoogleMapsError to contain status codes.
+Version 1.0
+Working version an API V3,
 
-Version 1.0.1:
-Fixed local search throwing an exception if Google returned fewer results
-than requested.
-
-Version 1.0:
-Initial Release
-
 #!/usr/bin/env python
-
-# Copyright 2009 John Kleint
 #
-# This is free software, licensed under the Lesser Affero General 
-# Public License, available in the accompanying LICENSE.txt file.
+# Xiao Yu - Montreal - 2010
+# Based on googlemaps by John Kleint
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
 
 
 """
-Distutils setup script for googlemaps module.
+Distutils setup script for pygeocoder module.
 """
 
 
 from distutils.core import setup
 import sys
 
-sys.path.insert(0, 'googlemaps')
-import googlemaps
+sys.path.insert(0, 'pygeocoder')
+import pygeocoder
 
 
-setup(name='googlemaps',
-      version=googlemaps.VERSION,
-      author='John Kleint',
-      author_email='py-googlemaps-general@lists.sourceforge.net',
-      url='http://sourceforge.net/projects/py-googlemaps/',
-      download_url='https://sourceforge.net/projects/py-googlemaps/files/',
-      description='Easy geocoding, reverse geocoding, driving directions, and local search in Python via Google.',
-      long_description=googlemaps.GoogleMaps.__doc__,
-      package_dir={'': 'googlemaps'},
-      py_modules=['googlemaps'],
-      provides=['googlemaps'],
+setup(name='pygeocoder',
+      version=pygeocoder.VERSION,
+      author='Xiao Yu',
+      author_email='xiao@xiao-yu.com',
+      url='http://code.xster.net/pygeocoder',
+      download_url='https://bitbucket.org/xster/pygeocoder/downloads',
+      description='Python interface for Google Geocoding API V3.',
+      long_description=pygeocoder.Geocoder.__doc__,
+      package_dir={'': 'pygeocoder'},
+      py_modules=['pygeocoder'],
+      provides=['pygeocoder'],
       requires=['simplejson'],
-      classifiers=['Development Status :: 5 - Production/Stable',
+      classifiers=['Development Status :: 4 - Beta',
                    'Intended Audience :: Developers',
                    'Natural Language :: English',
                    'Operating System :: OS Independent',
                    'Programming Language :: Python :: 2',
                    'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)',
-                   'License :: OSI Approved :: GNU Affero General Public License v3',
                    'Topic :: Internet',
                    'Topic :: Internet :: WWW/HTTP',
                    'Topic :: Scientific/Engineering :: GIS',
+				   'Topic :: Software Development :: Libraries :: Python Modules',
                   ],
-      keywords='google maps local search ajax api geocode geocoding directions navigation json',
-      license='Lesser Affero General Public License v3',
+      keywords='google maps ajax api geocode geocoding address gps json',
+      license='Lesser General Public License v3',
      )

File test/test_googlemaps.py

 #!/usr/bin/env python
-
-# Copyright 2009 John Kleint
 #
-# This is free software, licensed under the Lesser Affero General 
-# Public License, available in the accompanying LICENSE.txt file.
+# Xiao Yu - Montreal - 2010
+# Based on googlemaps by John Kleint
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
 
 
 """
-Unit tests for googlemaps.
+Unit tests for pygeocoder.
 
 """
 
 import unittest
 import doctest
     
-import googlemaps
-from googlemaps import GoogleMaps    
-
-    
-# You might need an actual key to run the tests.
-GMAPS_API_KEY = open('gmaps-api-key.txt').readline().strip() 
+import pygeocoder
+from pygeocoder import Geocoder    
 
 
 def searchkey(obj, key):
         
         addr2 = gmaps.latlng_to_address(lat, lng)
         self.assertEqual(addr, addr2)
-        
-
-    def test_local_search(self):
-        """Test googlemaps local_search()."""
-        gmaps = GoogleMaps(GMAPS_API_KEY, referrer_url='http://www.google.com/')
-        local = gmaps.local_search('sushi san francisco, ca')
-        result = local['responseData']['results'][0]
-        self.assertEqual(result['titleNoFormatting'], 'Sushi Groove')
-        
-        results = gmaps.local_search('Starbucks Los Angeles, CA', numresults=GoogleMaps.MAX_LOCAL_RESULTS)
-        self.assertEqual(results['responseStatus'], googlemaps.STATUS_OK)
-        self.assertNotEqual(results['responseData'], None)
-        self.assertNotEqual(results['responseData']['cursor'], None)
-        results = results['responseData']['results']
-        self.assertEqual(len(results), GoogleMaps.MAX_LOCAL_RESULTS)
-        for result in results:
-            self.assertEqual(result['GsearchResultClass'], 'GlocalSearch')
-            self.assert_(result['titleNoFormatting'].lower().find('starbucks') >= 0)
-            self.assertEqual(result['region'], 'CA')
-        
-
-    def test_directions(self):
-        """Test googlemaps directions()"""
-        
-        gmaps = GoogleMaps(GMAPS_API_KEY)
-        results = gmaps.directions('Constitution Ave NW & 10th St NW, Washington, DC',
-                                   'Independence and 6th SW, Washington, DC 20024, USA')
-        self.assertEqual(results['Status']['code'], googlemaps.STATUS_OK)
-        self.assert_(results['Directions']['Duration']['seconds'] in range(100, 130))
-        self.assert_(results['Directions']['Distance']['meters'] in range(1000, 1050))
-        routes = results['Directions']['Routes']
-        self.assert_(len(routes) >= 1)
-        self.assertEqual(routes[0]['Duration'], results['Directions']['Duration'])
-        self.assertEqual(routes[0]['Distance'], results['Directions']['Distance'])
-        self.assert_(routes[0]['Steps'][0]['descriptionHtml'].find('Constitution Ave') >= 0)
-        self.assert_(routes[0]['Steps'][1]['descriptionHtml'].find('7th St') >= 0)
-        self.assert_(routes[0]['Steps'][2]['descriptionHtml'].find('Independence Ave') >= 0)
-        
-    def test_doctests(self):
-        """Run googlemaps doctests"""
-        doctest.testmod(googlemaps, extraglobs={'api_key': GMAPS_API_KEY})
 
         
 if __name__ == "__main__":