Generate database of UTF-8 encoded postal addresses
Closed - This job posting has been filled and work has been completed.
(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:
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_COU
kill the amazon instance
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
Makes curl or wget call to: http://open.mapquestapi.com/xapi/a
EXAMPLE (with float=1): http://open.mapquestapi.com/xapi/a
Assigns returned XML to an array of arrays.
If at end of float array OR number of nodes(arrays in array) greater than 150
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/ap
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,forma
Return the first 100 (or all) of the successfully reverse geocoded lat/lons as CSV content to the caller of the script (Script 2)
Skills: linux, json, english