Skip to content

Chrisxlchen/GeoService

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GeoService

The documentation will cover following topics

  • How to run program
  • How use api provided by the service
  • How to run unit test with coverage

How to run program

  1. From pycharm

    • Open GeoService from pycharm.
    • Go to, File | Settings | Project: GeoService | Project Interpreter, add new venv in the project use python3.
    • run "pip3 install -r requirements.txt" in pycharm terminal window
    • Verify by unit test. "cd app", "./run_unittest.sh"
    • run main.py
  2. From command line:

    • cd GeoService
    • sudo apt-get install python3-pip
    • sudo pip3 install virtualenv
    • virtualenv venv
    • source venv/bin/activate
    • pip3 install -r requirements.txt
    • cd app
    • ../venv/bin/python main.py
  3. Use docker for Production

    • cd GeoService
    • docker build . -t geo_service_image
    • docker run -d --name geo_container -p 80:80 geo_service_image

How use api provided by the service

Only one api supported by service for now.

  1. retrieve address API:
    • API:

      • In production mode use: http:///api/v1/geocoding/retrieveaddress//
      • In development mode use: http://:5000/api/v1/geocoding/retrieveaddress//
    • Note:

      Provide your ip and latitude and longitude to the <>. It will try first with google geocoding service, if fail will try here geocoding service.

    • Return Values:

      • Return Err Code 500 if all the service are unavailabe
      • Return Err Code 400 if the parameters or api contains error is wrong
      • Return Json obj if successfully retrieved address. The result format as following: {'Label': '425 W Randolph St, Chicago, IL 60606, United States', 'Country': 'USA', 'State': 'IL', 'County': 'Cook', 'City': 'Chicago', 'District': 'West Loop', 'Street': 'W Randolph St', 'HouseNumber': '425', 'PostalCode': '60606'}
    • Example:

      {"Label": "425 W Randolph St, Chicago, IL 60606, USA", "HouseNumber": "425", "Street": "W Randolph St", "District": "West Loop", "City": "Chicago", "County": "Cook County", "State": "IL", "Country": "US", "PostalCode": "60606"}

      For python code example please check file google_geocoding.py in the this project.

How to run unit test with coverage

  • cd Geoservice/app
  • ./run_unittest.sh

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages