python学习之Geospatial Analysis
来源:互联网 发布:linux chmod 777 目录 编辑:程序博客网 时间:2024/06/05 21:03
参考代码
Learning Geospatial Analysis with Python
import turtle as tNAME = 0POINTS = 1POP = 2state = ['colorado',[[-109,37],[-109,41],[-102,41],[-102,37]],5187582]cities = []cities.append(['denver',[-104.98,39.74],634265])cities.append(['boulder',[-105.27,40.02],98889])cities.append(['durango',[-107.8,37.28],170691])map_width = 500map_height = 300minx = 180maxx = -180miny = 90maxy = -90for x,y in state[POINTS]: if x < minx : minx = x elif x > maxx : maxx = x if y < miny : miny = y elif y > maxy : maxy = ydist_x = maxx- minxdist_y = maxy - minyx_radio = map_width/dist_xy_radio = map_height/dist_ydef convert(point): lon = point[0] lat = point[1] x = map_width - ((maxx - lon)*x_radio) y = map_height - ((maxy - lat)*y_radio) x = x - (map_width/2) y = y - (map_height/2) return [x,y]t.up()first_pixel = Nonefor point in state[POINTS]: pixel = convert(point) print(pixel) if not first_pixel: first_pixel = pixel t.goto(pixel) t.down()t.goto(first_pixel) t.up()t.goto([0,0])t.write(state[NAME],align='center',font = ('arial',16,'bold'))
1图框
for city in cities: pixel = convert(city[POINTS]) t.up() t.goto(pixel) t.dot(10) t.write(city[NAME] + ", Pop.: " + str(city[POP]), align="left") t.up()biggest_city = max(cities, key=lambda city:city[POP])t.goto(0,-200)t.write("The biggest city is: " + biggest_city[NAME])western_city = min(cities, key=lambda city:city[POINTS])t.goto(0,-220)t.write("The western-most city is: " + western_city[NAME])t.pen(shown=False)t.done()
2投点
阅读全文
0 0
- python学习之Geospatial Analysis
- GDAL(Geospatial Data Abstraction Library) 学习资料
- 算法学习之Asymptotic Analysis
- 开始学习Python for Data Analysis
- Data Analysis学习笔记 --- Python数据分析入门知识
- Data Analysis学习笔记 --- Python数据清洗处理时间数据
- Data Analysis学习笔记 --- Python数据清洗对数据分组
- Data Analysis学习笔记 --- python数据清洗对数据聚合
- Data Analysis学习笔记 --- Python数据清洗对字符串处理
- Data Analysis学习笔记 --- Python数据清洗正则处理字符串
- Data Analysis学习笔记 --- python数据清洗矢量处理字符串
- Python sourcecode analysis-part1
- python for data analysis
- python Data analysis function
- Data Structures and Algorithm Analysis in C 学习之List
- mongoDB's Geospatial Indexing
- halcon 之 Blob Analysis
- Scrapy设置之Analysis
- UE4的“伤害”
- Oracle数据库操作相关
- linux的命令操作 工作QQ1063926600
- 通过xmanager远程桌面连接到centos服务器
- PHP--简单Demo
- python学习之Geospatial Analysis
- 插值(Interpolation)
- Java设计模式--单例模式
- 带有redis缓存的修改,对redis的操作解析
- dos 坏境搭建
- [JavaWeb基础]jsp
- C++双向链表
- 1018. 锤子剪刀布 (20)
- 设计一个有getMin功能的栈 程序员代码面试指南