城市直播房产教育博客汽车
快传网
汽车报价
买车新车
博客专栏
专题精品
教育留学
高考读书
房产家居
彩票视频
直播黑猫
投资微博
城市上海
政务旅游

Pythonshapefile。Writer方法代码示例

10月22日 不回头投稿
  本文整理汇总了Python中shapefile。Writer方法的典型用法代码示例。如果您正苦于以下问题:Pythonshapefile。Writer方法的具体用法?Pythonshapefile。Writer怎么用?Pythonshapefile。Writer使用的例子?那么恭喜您,这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shapefile的用法示例。
  在下文中一共展示了shapefile。Writer方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。示例1:init需要导入模块:importshapefile〔as别名〕或者:fromshapefileimportWriter〔as别名〕definit(self,filenameNone,shapeType1,hasShxTrue):self。filenamefilenameself。hasShxhasShxCountrecordsformetadataself。count0Maximumnumberofrecordsbeforediskflushself。max1000self。startedFalseself。minx0self。miny0self。maxx0self。maxy0self。numRecs0self。tmpShpcStringIO。StringIO()ifself。hasShx:self。tmpShxcStringIO。StringIO()self。tmpDbfcStringIO。StringIO()self。shpopen(s。shpself。filename,wb)ifself。hasShx:self。shxopen(s。shxself。filename,wb)self。dbfopen(s。dbfself。filename,wb)self。dbfHdrLen0self。wshapefile。Writer(shapeType)示例2:pointfile需要导入模块:importshapefile〔as别名〕或者:fromshapefileimportWriter〔as别名〕defpointfile(testfile):withshapefile。Writer(testfile,shapefile。POINT)asshp:shp。field(name,C)shp。point(0,0)shp。record(point1)shp。point(0,1)shp。record(point2)shp。point(1,1)shp。record(point3)shp。point(1,0)shp。record(point4)示例3:polygonfile需要导入模块:importshapefile〔as别名〕或者:fromshapefileimportWriter〔as别名〕defpolygonfile(testfile):withshapefile。Writer(testfile,shapefile。POLYGON)asshp:shp。field(name,C)shp。poly(〔〔〔。25,。25〕,〔。25,。25〕,〔。75,。25〕,〔。75,。25〕〕,〕)shp。record(polygon1)shp。poly(〔〔〔。25,。75〕,〔。75,。75〕,〔。5,1。25〕〕〕)shp。record(polygon2)示例4:polylinefile需要导入模块:importshapefile〔as别名〕或者:fromshapefileimportWriter〔as别名〕defpolylinefile(testfile):withshapefile。Writer(testfile,shapefile。POLYLINE)asshp:shp。field(name,C)n5xnp。repeat(np。linspace(0,1,n),2)ynp。tile(〔0。375,0。625〕,n)shp。line(〔list(zip(x,y))〕)shp。record(line1)示例5:testbadpoints需要导入模块:importshapefile〔as别名〕或者:fromshapefileimportWriter〔as别名〕deftestbadpoints():shpBytesIO()shxBytesIO()dbfBytesIO()wshapefile。Writer(shpshp,shxshx,dbfdbf)w。shapeType3w。field(spam,N)w。line(〔〔〔5,5〕,〔10,10〕〕〕)w。record(37)w。line(〔〔〔5,0〕,〔5,5〕〕〕)w。record(100)w。line(〔〔〔5,5〕,〔0,10〕〕〕)w。record(239)w。close()passalineshapefilehereinsted。pshpBytesIO()pshxBytesIO()pdbfBytesIO()pwshapefile。Writer(shppshp,shxpshx,dbfpdbf)w。shapeType3pw。field(spam,N)pw。line(〔〔〔5,5〕,〔10,10〕〕〕)pw。record(37)pw。line(〔〔〔5,0〕,〔5,5〕〕〕)pw。record(100)pw。line(〔〔〔5,5〕,〔0,10〕〕〕)pw。record(239)pw。close()withraises(ValueError):readshapefile(shp,dbfdbf,pointsshapefilepshp,pointsdbfpdbf)示例6:testpointsbuttoofar需要导入模块:importshapefile〔as别名〕或者:fromshapefileimportWriter〔as别名〕deftestpointsbuttoofar():shpBytesIO()shxBytesIO()dbfBytesIO()wshapefile。Writer(shpshp,shxshx,dbfdbf)w。shapeType3w。field(spam,N)w。line(〔〔〔5,5〕,〔10,10〕〕〕)w。record(37)w。line(〔〔〔5,0〕,〔5,5〕〕〕)w。record(100)w。line(〔〔〔5,5〕,〔0,10〕〕〕)w。record(239)w。close()makeapshpBytesIO()pshxBytesIO()pdbfBytesIO()pwshapefile。Writer(shppshp,shxpshx,dbfpdbf)pw。shapeType1pw。field(eggs,N)pw。point(5,0)pw。record(2)pw。point(5,5)pw。record(4)pw。point(0,10)pw。record(8)pw。point(12,10)pw。record(6)pw。close()withraises(ValueError):readshapefile(shp,dbfdbf,pointsshapefilepshp,pointsdbfpdbf)示例7:testpointsbutnotoneone需要导入模块:importshapefile〔as别名〕或者:fromshapefileimportWriter〔as别名〕deftestpointsbutnotoneone():shpBytesIO()shxBytesIO()dbfBytesIO()wshapefile。Writer(shpshp,shxshx,dbfdbf)w。shapeType3w。field(spam,N)w。line(〔〔〔5,5〕,〔10,10〕〕〕)w。record(37)w。line(〔〔〔5,0〕,〔5,5〕〕〕)w。record(100)w。line(〔〔〔5,5〕,〔0,10〕〕〕)w。record(239)w。close()makeapshpBytesIO()pshxBytesIO()pdbfBytesIO()pwshapefile。Writer(shppshp,shxpshx,dbfpdbf)pw。shapeType1pw。field(eggs,N)pw。point(5,0)pw。record(2)pw。point(5,5)pw。record(4)pw。point(0,10)pw。record(8)pw。point(10,10)pw。record(6)pw。point(10,10)pw。record(7)pw。close()withraises(ValueError):readshapefile(shp,dbfdbf,pointsshapefilepshp,pointsdbfpdbf)示例8:testpointsbutonemissing需要导入模块:importshapefile〔as别名〕或者:fromshapefileimportWriter〔as别名〕deftestpointsbutonemissing():shpBytesIO()shxBytesIO()dbfBytesIO()wshapefile。Writer(shpshp,shxshx,dbfdbf)w。shapeType3w。field(spam,N)w。line(〔〔〔5,5〕,〔10,10〕〕〕)w。record(37)w。line(〔〔〔5,0〕,〔5,5〕〕〕)w。record(100)w。line(〔〔〔5,5〕,〔0,10〕〕〕)w。record(239)w。close()makeapshpBytesIO()pshxBytesIO()pdbfBytesIO()pwshapefile。Writer(shppshp,shxpshx,dbfpdbf)pw。shapeType1pw。field(eggs,N)pw。point(5,0)pw。record(2)pw。point(5,5)pw。record(4)pw。point(0,10)pw。record(8)pw。close()withraises(ValueError):readshapefile(shp,dbfdbf,pointsshapefilepshp,pointsdbfpdbf)示例9:writeshapefile需要导入模块:importshapefile〔as别名〕或者:fromshapefileimportWriter〔as别名〕defwriteshapefile(df,filename,geomtypeline,prjNone):createashapefilegivenapandasDataframethathascoordinatedatainacolumncalledcoords。importshapefiledf〔Name〕df。indexcreateashpfilewriterobjectofgeomtypepointifgeomtypepoint:wshapefile。Writer(shapefile。POINT)elifgeomtypeline:wshapefile。Writer(shapefile。POLYLINE)elifgeomtypepolygon:wshapefile。Writer(shapefile。POLYGON)usethehelpermodetoensuretheofrecordsequalstheofshapes(shapefilearemadeupofshapesandrecords,andneedbothtobevalid)w。autoBalance1addthefieldsforfieldnameindf。columns:w。field(fieldname,C)fork,rowindf。iterrows():w。record(row。tolist())w。line(parts〔row。coords〕)w。save(filename)addprojectiondatatotheshapefile,ifprjisNone:ifnotsepcified,thedefault,projectionisused(PAStatePlane)prjos。path。join(ROOTDIR,swmmiodefsdefault。prj)prjfilepathos。path。splitext(filename)〔0〕。prjshutil。copy(prj,prjfilepath)
投诉 评论 转载

手机厂商跨界入局平板笔记本内卷堪忧?不!好戏才刚刚开始华为轮值董事长郭平在前几日的新员工座谈中谈到全世界有三个最大的工业领域,一是房地产;二是汽车,三是手机,华为手机业务受到影响,但在全屋智能、音频、显示设备、运动健康等方面获得了……华为公布最新进展,鸿蒙OS再次加快进度了?鸿蒙OS的系统自从被上线,就一直被大家所关注着的!尤其是广大花粉,他们都想知道自己的华为手机,什么时候才能真正升级为鸿蒙系统。而就目前来看,华为进一步加快了鸿蒙OS的升级进度,……Meta首席执行官扎克伯格因参与数据泄露决策遭起诉据央视新闻,当地时间5月23日,美国社交媒体平台脸书的母公司Meta首席执行官马克。扎克伯格被美国华盛顿特区总检察长卡尔。拉辛起诉,拉辛指控扎克伯格直接参与了导致与剑桥分析公司……华为matev折叠屏手机采用翻盖方案或12月下旬发布在折叠屏手机方面,华为一直拥有领先的优势,虽然目前华为在手机研发中遇到了众所周知的困难,但不久前仍有不少消息称华为将很快就会带来一款全新的折叠屏手机,并且还会采用与以往截然不同……出台互联网营销师职业技能标准的导向意义作者:万周近日,人社部、中央网信办、国家广播电视总局共同发布了互联网营销师国家职业技能标准。根据定义,互联网营销师是在数字化信息平台上,运用网络的交互性与传播公信力,对企……Pythonshapefile。Writer方法代码示例本文整理汇总了Python中shapefile。Writer方法的典型用法代码示例。如果您正苦于以下问题:Pythonshapefile。Writer方法的具体用法?Pytho……拼多多499。9,还差0。1就能提现。谁能提现成功?骗爹爹给了我499。95,让我找5个人砍,就能提现。砍到499。99时,转盘不出现金了,出金币,说集齐10枚金币,就可以提现。出了9枚金币后,再砍,变成砍一次0。1枚金币……资讯丨曝已有大批骁龙895898新机入网备案,最快12月中首高通正在开发一款代号为SM8450Waipio的芯片,将作为骁龙888(SM8350)的继任者。关于这款芯片的代号有不少猜测,有消息表示这款处理器将会命名为骁龙895或者……鸿蒙OS远超预期,央视正式为其正名,华为公司又定下新目标俗话说得好万事开头难,华为公司的鸿蒙OS系统经过漫长的研发期之后,一经上市迅速获得了众多用户的认可,不少升级鸿蒙OS系统的用户都表示鸿蒙OS系统比华为手机之前所用的EMUI流畅……柳传志执掌联想进入世界500强,却抵不过玩嘴的司马南柳传志执掌联想30余年,联想控股总资产6500亿,净资产过1000亿。现在变成联想发展好与柳传志没有半毛钱关系,联想问题都是柳传志问题麻烦问吃瓜群众一个问题,联想靠汉卡发……不考虑具体机型和预算,天玑1100和骁龙865,麒麟990,感谢邀请不考虑具体机型和预算,天玑1100和骁龙865,麒麟990,猎户座1080选哪个?客观一点来说,我会建议去选择三星的1080系列,因为只有用过才有发言权,我现在用……再过10天,全球首款5G手机发售,6个镜头骁龙855!期待2019各大厂商纷纷发布自己的旗舰机,近日据外媒发布消息,三星电子也不甘落后,已经正式对外宣布,将于4月5日开卖三星此前发布的三星S10的5G版本手机。这样一来,三星将会成为全……
戴尔发布17英寸的XPS笔记本,超高屏占比,网友真的爱了深扒头条一作者怀疑探索者之二云南大力推进光伏发电发展未来3年新增新能源装机将达5000万8月安卓手机排行榜出炉小米mix4流畅度排名第一设计师畅想三星GalaxyZ翻转屏智能机变形后神似回旋镖为什么极氪001双电机长续航版续航里程只有606km拼多多上竟有80岁还能长出新牙齿的神奇牙膏?专家天方夜谭最美MPV奔驰EQT正式亮相进军纯电MPV领域再次引领潮流才配的助听器,戴了助听器后感觉耳朵胀,是怎么回事?认识SpringBootApplication注解专业级拍鸟多长焦段比较合适?有推荐的镜头吗?华为mate40Pro对比荣耀Magic4Pro,同为高端旗
你知道吗夫妻之间最喜欢用到的做爱技巧行纪合同与委托合同有何不同古代河西走廊是怎样的存在?河西走廊的重要性介绍多梦会引起耳鸣吗多梦耳鸣吃什么药效果好高素贤:《我要的坚强不是你的肩膀》是那首歌里面的的歌词啊热评 MOTOXT535手机是否支持阅读器看过这个杀手不太冷看出这些东西了吗美国制裁助推中国芯片产业超速增长由于肥胖儿童的发育会受到哪些影响遇到旅游纠纷怎么处理出境游退团怎么赔偿热闻聚热点网 那些长期喝饮料的人,后来怎么样了?

友情链接:中准网聚热点快百科快传网快生活快软网快好知文好找江西南阳嘉兴昆明铜陵滨州广东西昌常德梅州兰州阳江运城金华广西萍乡大理重庆诸暨泉州安庆南充武汉辽宁