|
1 |
| -Using the Google Geocoding API with a Database and |
2 |
| -Visualizing data on Google Map |
| 1 | +Using the Google Geocoding API with a Database and Visualizing data on Google Map. |
| 2 | +In this project, we are using the Google geocoding API to clean up some user-entered geographic locations of |
| 3 | +university names and then placing the data on a Google Map. |
3 | 4 |
|
4 |
| -In this project, we are using the Google geocoding API |
5 |
| -to clean up some user-entered |
6 |
| -geographic locations of |
7 |
| -university names and then placing the data on a Google |
8 |
| -Map. |
9 |
| - |
10 |
| -You should install the SQLite browser to view and modify |
11 |
| -the databases from: |
12 |
| - |
13 |
| - |
14 |
| -http://sqlitebrowser.org/ |
15 |
| - |
16 |
| -The first problem to solve is that the Google geocoding |
17 |
| -API is rate limited to 2500 requests per day. So if you have |
18 |
| -a lot of data you might |
19 |
| -need to stop and restart the lookup |
20 |
| -process several times. So we break the problem into two |
| 5 | +The first problem to solve is that the Google geocoding API is rate limited to 2500 requests per day. |
| 6 | +So if you have a lot of data you might need to stop and restart the lookup process several times. So we break the problem into two |
21 | 7 | phases.
|
22 | 8 |
|
23 |
| -In the first phase we take our input data in the file |
24 |
| -(where.data) |
25 |
| -and read it one line at a time, and retreive the |
26 |
| -geocoded response and store it in a database (geodata.sqlite). |
27 |
| -Before we use the geocoding API, we simply check to see |
28 |
| - |
29 |
| -if |
30 |
| -we already have the data for that particular line of input. |
31 |
| - |
32 |
| -You can re-start the process at any time by removing the file |
33 |
| -geodata.sqlite |
34 |
| - |
35 |
| -Run the geoload.py program. |
36 |
| -This program will read the input |
37 |
| -lines in where.data and for each line check to see if it is already |
38 |
| -in the database and if we don't have the data for the location, |
39 |
| -call |
40 |
| -the geocoding API to retrieve the data and store it in |
| 9 | +In the first phase we take our input data in the file (where.data) and read it one line at a time, and retreive the |
| 10 | +geocoded response and store it in a database (geodata.sqlite).Before we use the geocoding API, we simply check to see |
| 11 | +if we already have the data for that particular line of input.You can re-start the process at any time by removing the file |
| 12 | +geodata.sqlite. |
| 13 | +Run the geoload.py program.This program will read the input lines in where.data and for each line check to see if it is already |
| 14 | +in the database and if we don't have the data for the location,call the geocoding API to retrieve the data and store it in |
41 | 15 | the database.
|
42 |
| - |
43 |
| - |
44 |
| -The geoload.py can be stopped at any time, and there is a counter |
45 |
| -that you can use to limit the number of calls to the geocoding |
| 16 | +The geoload.py can be stopped at any time, and there is a counter that you can use to limit the number of calls to the geocoding |
46 | 17 | API for each run.
|
47 |
| - |
48 |
| - |
49 |
| -Once you have some data loaded into geodata.sqlite, you can |
50 |
| -visualize the data using the (geodump.py) program. This |
51 |
| -program reads the database and writes tile file |
52 |
| - |
53 |
| -(where.js) |
54 |
| -with the location, latitude, and longitude in the form of |
| 18 | +Once you have some data loaded into geodata.sqlite, you can visualize the data using the (geodump.py) program. This |
| 19 | +program reads the database and writes tile file (where.js) with the location, latitude, and longitude in the form of |
55 | 20 | executable JavaScript code.
|
56 | 21 |
|
57 |
| -A run of the geodump.py program records written to where.js |
58 |
| - |
59 |
| - |
60 |
| -Open where.html to view the data in a browser |
61 |
| - |
62 |
| -The file (where.html) consists of HTML and JavaScript to visualize |
63 |
| -a Google Map. It reads the most recent data in |
64 |
| - |
65 |
| -where.js to get |
| 22 | +A run of the geodump.py program records written to where.js Open where.html to view the data in a browser |
| 23 | +The file (where.html) consists of HTML and JavaScript to visualize a Google Map. It reads the most recent data in where.js to get |
66 | 24 | the data to be visualized.
|
67 | 25 |
|
68 |
| - |
69 |
| -This is a JavaScript list of lists. The syntax for JavaScript |
70 |
| -list constants is very similar to Python so the syntax should |
| 26 | +This is a JavaScript list of lists. The syntax for JavaScript list constants is very similar to Python so the syntax should |
71 | 27 | be familiar to you.
|
72 | 28 |
|
73 |
| -Simply open where.html in a browser to see the locations. You |
74 |
| -can hover over each map pin to find the location that the |
75 |
| -gecoding API returned for the user-entered input. If you |
76 |
| -cannot see any data when you open the where.html file, you might |
| 29 | +Simply open where.html in a browser to see the locations. You can hover over each map pin to find the location that the |
| 30 | +gecoding API returned for the user-entered input. If you cannot see any data when you open the where.html file, you might |
77 | 31 | want to check the JavaScript or developer console for your browser.
|
78 | 32 |
|
0 commit comments