当前位置: 首页 > 工具软件 > databases > 使用案例 >

【题解】Databases and Visualization (peer-graded) (Using Databases with Python)

公西财
2023-12-01

吐槽:这个作业花了我挺长时间,究其原因是没有好好看 README.txt 的内容,不过浪费的时间还是足以让我学到些。

题目:Retrieving GEOData

Download the code from http://www.py4e.com/code3/geodata.zip - then unzip the file and edit where.data to add an address nearby where you live - don't reveal where you live. Then run the geoload.py to lookup all of the entries in where.data (including the new one) and produce the geodata.sqlite. Then run geodump.py to read the database and produce where.js. You can run the programs and then scroll back to take your screen shots when the program finishes. Then open where.html to visualize the map. Take screen shots as described below. Make sure that your added location shows in all three of your screen shots.

This is a relatively simple assignment. Don't take off points for little mistakes. If they seem to have done the assignment give them full credit. Feel free to make suggestions if there are small mistakes. Please keep your comments positive and useful. If you do not take grading seriously, the instructors may delete your response and you will lose points.

我的解法:

只在 where.data 最下面添加了一个离自己最近的大学,然后运行 geoload.py 生成 geodta.sqlite,之后运行 geodump.py 生成 where.js,再用 where.html 生成最终图像就可以了。

我想说的:

1,第一次我看完是一头雾水,然后逛了逛week5的论坛,发现(https://www.coursera.org/learn/python-databases/discussions/weeks/5/threads/ztVbrqlWEeef3wq1mGCy6A)后,因为感觉英文文档太多了,只好做个伸手党寻找有关google maps api的信息(https://www.leadong.com/id56671.html),确实里面写的也很详细,申请到了API_KEY,但是在应用的时候还是出现了问题:This API project is not authorized to use this API.,使用真实的google api key我到现在还没有弄懂,如果有人知道怎么做的话,希望可以给我留言。

2,后来仔细看了一下那个论坛的内容,搜索了错误信息,发现助教给一些同学的回复是认真读README.txt,然后确实发现api_key = False是可以访问老师提供的网站也就是查询的一个子集,所以不需要更改geoload.py就可以成功生成咯。

补充:

2020/2/28:确实需要用vpn才能生成最后的图像,因为是用的google地图。为了这个作业还买了一个月vpn= =醉了。

2020/3/16:where.data 的打开方式选择记事本就可以进行编辑并保存。.data文件的详情可以看这个(https://zhidao.baidu.com/question/936404214430011172.html)。

 类似资料: