安庆大理运城常德铜陵江西
投稿投诉
江西南阳
嘉兴昆明
铜陵滨州
广东西昌
常德梅州
兰州阳江
运城金华
广西萍乡
大理重庆
诸暨泉州
安庆南充
武汉辽宁

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版本手机。这样一来,三星将会成为全……
Web3。0安全考虑事项和影响1978年他用4200元买下一台电脑,43年后价格涨到960中外科学家实现高维量子纠缠态最优检测买红米K50还是真我GTNeo3?对比各自的优缺点后,终于不可以控制螃蟹的蟹奴,是怎么把螃蟹身体掏空的?90地级市覆盖,服务中心遍布全国,OPPO售后是如何获得好评最新手机好评榜TOP10华为2款,小米名落孙山,荣耀登顶中国或于2022年全面推行电子驾照英国计划2040年起禁售柴华为P50Pro开箱计算光学技术让手机摄影进入算法时代?大厂人事阿里云人事大变动柔宇成立EMC及六大子公司短刘海直角边框,国产手机巨头推新机,致敬iPhone13?新蓝牙漏洞曝光,威胁全球数十亿WiFi设备极限假设思维在化学问题求解中的运用无锡婚纱摄影苹果MacBookPro新机外观曝光机身更薄性能更强猜猜都像谁英雄无敌3的兵种大头贴城堡作文骝马新跨白玉鞍,战罢沙场月色寒。意思翻译、赏析加拿大用英语怎么读加拿大用英语如何读老婆特爱吃肉又担心自己会发胖淘宝店铺单品运营思路藏区驻村的“三大改变”春燕来到日内瓦2014GenevaInternational国内又一车企倒下?1年亏损112亿,创始人却早已套现离场

友情链接:中准网聚热点快百科快传网快生活快软网快好知文好找七猫云易事利