Generate database of UTF-8 encoded postal addresses

Generate database of UTF-8 encoded postal addresses

Closed - This job posting has been filled and work has been completed.

Job Description

(NOTE, you will need your own Amazon AWS account to write and test this with)
(or submit it to me to test)

I need 3 scripts written.

-----------------------------------------------------------------------------------------------------
A/ Linux Bash Script -
Command line arguments:
file name to read from,
path and root file name to write to
the id/password/keys, etc to access Amazon AWS,
an AMI instance id
Opens a file and reads in the lines/fields.
Starts a loop, each iteration:
reads line in file
extracts geocoordinates. country name, locale/langauge for country.
starts 2nd BAsh script in the background with 'nohup' and passes in via command line argument:
AWS id/password/keys
geocordinates,
country name,
locale/language for country
path and root filename to write output to
Exits when all 100 or so background processes are started
-----------------------------------------------------------------------------------------------------
B/ Linux Bash Script
Command Line arguments: (see above)

Creates Amazon EC2 micro instance
Creates Elastic IP,
associates the IP to the Instance,
Loads an Image from AWS (LAMP)
Uploads (via SSH) the 3rd script to the PHP Document root.
Calls the PHP file name under the elastic IP
URL arguments are
the Geocordinates of an country capital
name of the country (in english from file)
and the locale for the main langauge of the country.
Writes the returned CSV to a file in the /path/root_file_name.TWO_LETTER_COUNTRY_CODE.txt
kill the amazon instance
exit
-----------------------------------------------------------------------------------------------------
C/ PHP Script
GET URL variables are: (see above)

creates array of floats: 0.1, 0.3, 0.7,1.0,1.3,1.7,2.0
Starts foreach on array of floats, for each iteration:
Takes geocoordinates of capital city passed in URL and creates following four variables
longitude-float
latitude-float
longitude+float
latitude+float
Makes curl or wget call to: http://open.mapquestapi.com/xapi/api/0.6/node%5Bamenity=*%5D%5Bbbox=longitude-float,latitude-float,longitude+float,latitude+float%5D
EXAMPLE (with float=1): http://open.mapquestapi.com/xapi/api/0.6/node%5Bamenity=*%5D%5Bbbox=69,33,71,35%5D
Assigns returned XML to an array of arrays.
If at end of float array OR number of nodes(arrays in array) greater than 150
break
continue
Starts foreach on array of arrays:
extract latitude and longitude from inner array
Set up curl or wget header for locale or language passed in URL so google returns result in local language
Make curl or wget call to: http://maps.googleapis.com/maps/api/geocode/json?latlng=latitude,longitude&sensor=true
EXAMPLE: http://maps.googleapis.com/maps/api/geocode/json?latlng=34.5414523,69.2047571&sensor=true
Convert returned JSON to PHP arrays of arrays, etc.
(THIS SHOULD BE UTF-8 text, treat it as such!!)
Take the FIRST result object in the JSON array of objects retunred and:
take the 'formatted_address' element from that (WHICH WILL BE IN THE LANGUAGE OF THE HEADER)
create/append to a CSV string such as 'country_code,language/locale,formatted_address,latitude,longitude,amenity_type'\n
Return the first 100 (or all) of the successfully reverse geocoded lat/lons as CSV content to the caller of the script (Script 2)
exit

---
Skills: linux, json, english