Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Assignment 2 Begins Here.
- String latitude = new String();
- String longitute = new String();
- JSONObject one;
- File file2 = new File(
- "C:\\Users\\hiba\\eclipse-workspace\\CST8284\\src\\Assignment1\\output\\OutputAddresses.csv");
- try {
- BufferedReader txt1 = new BufferedReader(new FileReader(file2));
- BufferedWriter out1 = new BufferedWriter(new FileWriter(
- "C:\\Users\\hiba\\eclipse-workspace\\CST8284\\src\\Assignment1\\output\\LongLat.csv"));
- ArrayList<Person> persons = new ArrayList<Person>();
- ArrayList<Address> addresses = new ArrayList<Address>();
- while (txt1.readLine() != null) {
- one = new JSONObject();
- Person newPerson = new Person();
- Address newAddress = new Address();
- String[] line = txt1.readLine().split(",");
- newPerson.setFirstName(line[0]);
- newPerson.setLastName(line[1]);
- newPerson.setSpouseFirstName(line[2]);
- newPerson.setSpouseLastName(line[3]);
- newAddress.setStreetName(line[4]);
- newAddress.setStreetType(line[5]);
- newAddress.setProvince(line[6]);
- newAddress.setStreetOrientation(line[7]);
- newAddress.setCityName(line[8]);
- newAddress.setProvince(line[9]);
- persons.add(newPerson);
- addresses.add(newAddress);
- }
- URL url1 = new URL(
- "https://maps.googleapis.com/maps/api/geocode/json?address={address]AIzaSyAgSX7ZAI1PrUDMs2Djmv0YYmVTpk2y4GQ");
- HttpURLConnection con =
- (HttpURLConnection) url1.openConnection();
- txt1.close();
- out1.close();
- } catch (ArrayIndexOutOfBoundsException exception) {
- exception.printStackTrace();
- }
- txt.close();
- out.close();
- } catch (Exception exception) {
- exception.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement