GithubHelp home page GithubHelp logo

geo-address's Introduction

Geo Address

Exercise creating an API for looking up a street address's geo location using Googles GeoCode API.

Usage

Usage:
	-h , --help : this munu
	-a , --address : address to lookup
	-f , --file: file path of addresses

The implemented main method accepts arguments with the following format "1600 Amphitheatre Parkway, Mountain View, CA" in singular form or a line delimited list file format.

eg:

777 Brockton Avenue, Abington MA 2351
30 Memorial Drive, Avon MA 2322
250 Hartford Avenue, Bellingham MA 2019

Building

Maven is being utilized as the build tool with minimum dependancies.

$> mvn package

Running

The maven build created a runnable jar without dependancies. However dependancies were copied as part of the build to ${project.build.directory}/libs and referenced in the jars META-INF/MANIFEST.MFfile.

# Usage
$> java -jar target/geo-address-0.0.1.jar
Usage:
	-h , --help : this munu
	-a , --address : address to lookup
	-f , --file: file path of addresses

# Lookup address 
$> java -jar target/geo-address-0.0.1.jar -a "777 Brockton Avenue, Abington MA 2351"
{"address":"777 Brockton Avenue, Abington MA 2351","status":"FOUND","location":{"lat":-70.9686115,"lng":42.0963462}}

# List of address
$> java -jar target/geo-address-0.0.1.jar -f src/test/resources/addresses.txt

....

$>

Test Cases

There is fairly good coverage, of course there can alway be more. Special note should be taken all but one test in org.cjwilson.geoaddress.AppTest are being ignored. As these are live tests calling the actual service. Future version may introduce Mokito for better coverage.

Annoyances and Shortcomings

Limits

Although the GeoCode api usage limit documents 2,500 requests per day the service consistently reports its status as OVER_QUERY_LIMIT when it is not. This is handled by trapping the status and sleeping for three seconds, resetting the count and repeating the request. One potential issue with this strategy is if the service is in fact OVER_QUERY_LIMIT the application will loop gracefully FOREVER!

Multi-Threading

Of course there are always some advanced functionality and implementing multi threaded requests is on the list. The application currently runs synchronously, for better performance an asynchronous approach would improve execution time.

API Key

There was consideration to include a switch in the GeoCode api to include a Google API key. Although one was available the functionality was NOT implemented.. Perhaps on the next version. ๐Ÿ˜

Address Resolution

It was observed that the service will respond with a status of "OK" and provide a geo location if the address is wrong. The service apparently, once the address is parsed, will return results for any segment of the address that is resolvable. For instance if the street address is incorrect is will revert to the City and Zip. If any of the those two segments are wrong it will return results for one of those two. Only when all segments of the request are unresolvable will it return zero results.

Example of Not Found:

$> java -jar target/geo-address-0.0.1.jar -a "1313 Mockingbird Lane, The Moon MA 2350"
{"address":"1313 Mockingbird Lane, The Moon MA 2350","status":"NOT_FOUND","location":{"lat":0.0,"lng":0.0}}

geo-address's People

Contributors

cuzz22000 avatar

Watchers

 avatar

geo-address's Issues

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.