楼主: Reader's
1408 3

【GitHub】ArcPy and ArcGIS Second Edition by Packt [推广有奖]

  • 0关注
  • 0粉丝

已卖:1521份资源

博士生

59%

还不是VIP/贵宾

-

TA的文库  其他...

可解釋的機器學習

Operations Research(运筹学)

国际金融(Finance)

威望
0
论坛币
41198 个
通用积分
2.6173
学术水平
7 点
热心指数
5 点
信用等级
5 点
经验
2201 点
帖子
198
精华
1
在线时间
36 小时
注册时间
2015-6-1
最后登录
2024-3-3

楼主
Reader's 发表于 2017-8-13 05:04:59 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
Chapter_02Code files uploaded

Jun 28, 2017

Chapter_04Code files uploaded

Jun 28, 2017

Chapter_05Code files uploaded

Jun 28, 2017

Chapter_06Code files uploaded

Jun 28, 2017

Chapter_07Code files uploaded

Jun 28, 2017

Chapter_09Code files uploaded

Jun 28, 2017

Chapter_10Code files uploaded

Jun 28, 2017

Chapter_12Code files uploaded

Jun 28, 2017

Chapter_13Code files uploaded

Jun 28, 2017

LICENSEUpdate LICENSE

Jul 12, 2017

README.mdReadme file uploaded

Jun 28, 2017


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:Edition Second GitHub editio dition

本帖被以下文库推荐

沙发
Reader's 发表于 2017-8-13 05:05:55
  1. # -*- coding: utf-8 -*-
  2. # ---------------------------------------------------------------------------
  3. # Chapter2Model1.py
  4. # Created on: 2017-01-26 04:26:31.00000
  5. #   (generated by ArcGIS/ModelBuilder)
  6. # Description:
  7. # ---------------------------------------------------------------------------

  8. #Import libraries
  9. import arcpy
  10. import csv

  11. # if uncommented, the next line allows for overwriting existing files with output. Be careful!
  12. arcpy.env.overwriteOutput = True   

  13. # Local variables:
  14. Bus_Stops = r"C:\Projects\SanFrancisco.gdb\SanFrancisco\Bus_Stops"
  15. CensusBlocks2010 = r"C:\Projects\SanFrancisco.gdb\SanFrancisco\CensusBlocks2010"
  16. Inbound71 = r"C:\Projects\SanFrancisco.gdb\Chapter2Results\Inbound71"
  17. Inbound71_400ft_buffer = r"C:\Projects\SanFrancisco.gdb\Chapter2Results\Inbound71_400ft_buffer"
  18. Intersect71Census = r"C:\Projects\SanFrancisco.gdb\Chapter2Results\Intersect71Census"

  19. # Process: Select
  20. arcpy.Select_analysis(Bus_Stops,
  21.                       Inbound71,
  22.                       "NAME = '71 IB' AND BUS_SIGNAG = 'Ferry Plaza'")

  23. # Process: Buffer
  24. arcpy.Buffer_analysis(Inbound71,
  25.                       Inbound71_400ft_buffer,
  26.                       "400 Feet", "FULL", "ROUND", "NONE", "")

  27. # Process: Intersect
  28. arcpy.Intersect_analysis([Inbound71_400ft_buffer,CensusBlocks2010],
  29.                          Intersect71Census, "ALL", "", "INPUT")

  30. # Organize the census block population using a dictionary
  31. # The stop ID is the key and the census block populations are added to a list as the value
  32. dataDictionary = {}
  33. with arcpy.da.SearchCursor(Intersect71Census, ["STOPID","POP10"]) as cursor:
  34.     for row in cursor:
  35.         busStopID = row[0]
  36.         pop10 = row[1]
  37.         if busStopID not in dataDictionary.keys():
  38.             dataDictionary[busStopID] = [pop10]
  39.         else:
  40.             dataDictionary[busStopID].append(pop10)

  41. #Create an output CSV spreadsheet. Check the folder path to be sure it's legal
  42. with open(r'C:\Projects\Averages.csv', 'wb') as csvfile:
  43.     csvwriter = csv.writer(csvfile, delimiter=',')
  44.     for busStopID in dataDictionary.keys():
  45.         popList = dataDictionary[busStopID]
  46.         averagePop = sum(popList)/len(popList)
  47.         data = [busStopID, averagePop]
  48.         csvwriter.writerow(data)

  49. print "Data Analysis Complete"
复制代码

藤椅
军旗飞扬 在职认证  发表于 2017-8-13 06:34:03
谢谢楼主分享!

板凳
lianqu 发表于 2017-8-15 10:22:46

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2026-1-9 13:35