范文健康探索娱乐情感热点
热点动态
科技财经
情感日志
励志美文
娱乐时尚
游戏搞笑
探索旅游
历史星座
健康养生
美丽育儿
范文作文
教案论文

Pythonshapefile。Writer方法代码示例

  本文整理汇总了Python中 shapefile.Writer方法 的典型用法代码示例。如果您正苦于以下问题:Python shapefile.Writer方法的具体用法?Python shapefile.Writer怎么用?Python shapefile.Writer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在 类 shapefile  的用法示例。
  在下文中一共展示了 shapefile.Writer方法 的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。 示例1: __init__# 需要导入模块: import shapefile [as 别名] # 或者: from shapefile import Writer [as 别名] def __init__(self, filename=None, shapeType=1, hasShx=True):     self.filename = filename     self.hasShx = hasShx     # Count records for metadata     self.count = 0     # Maximum number of records before disk flush     self.max = 1000     self.started = False     self.minx = 0     self.miny = 0     self.maxx = 0     self.maxy = 0     self.numRecs = 0     self.tmpShp = cStringIO.StringIO()     if self.hasShx:       self.tmpShx = cStringIO.StringIO()     self.tmpDbf = cStringIO.StringIO()     self.shp = open("%s.shp" % self.filename, "wb")     if self.hasShx:       self.shx = open("%s.shx" % self.filename, "wb")     self.dbf = open("%s.dbf" % self.filename, "wb")     self.dbfHdrLen = 0     self.w = shapefile.Writer(shapeType) 示例2: _point_file# 需要导入模块: import shapefile [as 别名] # 或者: from shapefile import Writer [as 别名] def _point_file(test_file):     with shapefile.Writer(test_file, shapefile.POINT) as shp:         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: _polygon_file# 需要导入模块: import shapefile [as 别名] # 或者: from shapefile import Writer [as 别名] def _polygon_file(test_file):     with shapefile.Writer(test_file, shapefile.POLYGON) as shp:         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: _polyline_file# 需要导入模块: import shapefile [as 别名] # 或者: from shapefile import Writer [as 别名] def _polyline_file(test_file):     with shapefile.Writer(test_file, shapefile.POLYLINE) as shp:         shp.field("name", "C")          n = 5         x = np.repeat(np.linspace(0, 1, n), 2)         y = np.tile([0.375, 0.625], n)         shp.line([list(zip(x, y))])         shp.record("line1") 示例5: test_bad_points# 需要导入模块: import shapefile [as 别名] # 或者: from shapefile import Writer [as 别名] def test_bad_points():     shp = BytesIO()     shx = BytesIO()     dbf = BytesIO()     w = shapefile.Writer(shp=shp, shx=shx, dbf=dbf)     w.shapeType = 3     w.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()      # pass a line shapefile here insted.     p_shp = BytesIO()     p_shx = BytesIO()     p_dbf = BytesIO()     p_w = shapefile.Writer(shp=p_shp, shx=p_shx, dbf=p_dbf)     w.shapeType = 3     p_w.field("spam", "N")     p_w.line([[[5, 5], [10, 10]]])     p_w.record(37)     p_w.line([[[5, 0], [5, 5]]])     p_w.record(100)     p_w.line([[[5, 5], [0, 10]]])     p_w.record(239)     p_w.close()      with raises(ValueError):         read_shapefile(shp, dbf=dbf, points_shapefile=p_shp, points_dbf=p_dbf) 示例6: test_points_but_too_far# 需要导入模块: import shapefile [as 别名] # 或者: from shapefile import Writer [as 别名] def test_points_but_too_far():     shp = BytesIO()     shx = BytesIO()     dbf = BytesIO()     w = shapefile.Writer(shp=shp, shx=shx, dbf=dbf)     w.shapeType = 3     w.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()      # make a     p_shp = BytesIO()     p_shx = BytesIO()     p_dbf = BytesIO()     p_w = shapefile.Writer(shp=p_shp, shx=p_shx, dbf=p_dbf)     p_w.shapeType = 1     p_w.field("eggs", "N")     p_w.point(5, 0)     p_w.record(2)     p_w.point(5, 5)     p_w.record(4)     p_w.point(0, 10)     p_w.record(8)     p_w.point(12, 10)     p_w.record(6)     p_w.close()      with raises(ValueError):         read_shapefile(shp, dbf=dbf, points_shapefile=p_shp, points_dbf=p_dbf) 示例7: test_points_but_not_one_one# 需要导入模块: import shapefile [as 别名] # 或者: from shapefile import Writer [as 别名] def test_points_but_not_one_one():     shp = BytesIO()     shx = BytesIO()     dbf = BytesIO()     w = shapefile.Writer(shp=shp, shx=shx, dbf=dbf)     w.shapeType = 3     w.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()      # make a     p_shp = BytesIO()     p_shx = BytesIO()     p_dbf = BytesIO()     p_w = shapefile.Writer(shp=p_shp, shx=p_shx, dbf=p_dbf)     p_w.shapeType = 1     p_w.field("eggs", "N")     p_w.point(5, 0)     p_w.record(2)     p_w.point(5, 5)     p_w.record(4)     p_w.point(0, 10)     p_w.record(8)     p_w.point(10, 10)     p_w.record(6)     p_w.point(10, 10)     p_w.record(7)     p_w.close()      with raises(ValueError):         read_shapefile(shp, dbf=dbf, points_shapefile=p_shp, points_dbf=p_dbf) 示例8: test_points_but_one_missing# 需要导入模块: import shapefile [as 别名] # 或者: from shapefile import Writer [as 别名] def test_points_but_one_missing():     shp = BytesIO()     shx = BytesIO()     dbf = BytesIO()     w = shapefile.Writer(shp=shp, shx=shx, dbf=dbf)     w.shapeType = 3     w.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()      # make a     p_shp = BytesIO()     p_shx = BytesIO()     p_dbf = BytesIO()     p_w = shapefile.Writer(shp=p_shp, shx=p_shx, dbf=p_dbf)     p_w.shapeType = 1     p_w.field("eggs", "N")     p_w.point(5, 0)     p_w.record(2)     p_w.point(5, 5)     p_w.record(4)     p_w.point(0, 10)     p_w.record(8)     p_w.close()      with raises(ValueError):         read_shapefile(shp, dbf=dbf, points_shapefile=p_shp, points_dbf=p_dbf) 示例9: write_shapefile# 需要导入模块: import shapefile [as 别名] # 或者: from shapefile import Writer [as 别名] def write_shapefile(df, filename, geomtype="line", prj=None):     """     create a shapefile given a pandas Dataframe that has coordinate data in a     column called "coords".     """      import shapefile     df["Name"] = df.index      # create a shp file writer object of geom type "point"     if geomtype == "point":         w = shapefile.Writer(shapefile.POINT)     elif geomtype == "line":         w = shapefile.Writer(shapefile.POLYLINE)     elif geomtype == "polygon":         w = shapefile.Writer(shapefile.POLYGON)      # use the helper mode to ensure the # of records equals the # of shapes     # (shapefile are made up of shapes and records, and need both to be valid)     w.autoBalance = 1      # add the fields     for fieldname in df.columns:         w.field(fieldname, "C")      for k, row in df.iterrows():         w.record(*row.tolist())         w.line(parts=[row.coords])      w.save(filename)      # add projection data to the shapefile,     if prj is None:         # if not sepcified, the default, projection is used (PA StatePlane)         prj = os.path.join(ROOT_DIR, "swmmio/defs/default.prj")     prj_filepath = os.path.splitext(filename)[0] + ".prj"     shutil.copy(prj, prj_filepath)

小R角真全面屏各种黑科技,小米MIX4真的回来了8月份,小米有款屏下摄像头旗舰机发布,至于是不是MIX之前还不确定,不过从今天数码闲聊站曝光的这张新机钢化膜看,基本可以确定,这就是MIX。真全面屏窄边框小R角,不按套路的一点,它极米科技引领科技前沿,极米H3S强大超前极米H3S是极米科技于2021年3月16日推出的一款拥有1080P全高清的智能投影。据了解,该产品在预售期间就获得了市场较高关注度,首批现货一经发售便迅速售罄,深受用户的喜爱。能够实力圈粉,揭秘王者荣耀的5V5团队作战哲学一大清早看到玩家们吵起来了。其实大可不必,两个游戏都有自己的玩家群体,玩好自己的游戏就是了,两个游戏都是好游戏,为什么要争吵呢?营销号也不要总是为了流量踩一捧一了。在团队竞技手游中8个神奇的小网站,原地开启新世界大门谁能知道我网上冲浪的时候,都在收藏夹里收藏了一堆什么奇奇怪怪的东西狗头今天就把这些奇奇怪怪,但又迷之有趣的网站分享给大家,一起来看看吧1。任意门打开这个网站,点LETSGO会被传送16个宝藏小众网站,带你看见更大的创意世界我从我收藏的一大堆网站中,整理出了这16个我根本离不开的网站!一各种大全网站1。配色大全dopelycolors一个神奇的配色网站,一打开就是花里胡哨的。点最下面的骰子,就可以随机9个暗藏惊险与刺激的网站,叩开你新世界的大门这9个暗藏惊险与刺激的小众网站,绝对能叩开你新世界的大门!1外表平平的3D作品合集这个网站乍一看平平无奇,就是一些图片展示嘛,但是当你随意点击一个图片进入后,哇靠惊呆了,全都是动态特朗普政府将小米列入黑名单,称其为中国军事公司虽然任期只有六天,但是特朗普政府已决定将另一家中国电子巨头放在黑名单上世界第三大手机制造商小米。美国国防部现将小米指定为中国军事公司,这意味着它现在容易受到特朗普禁止美国投资此类公特朗普政府将小米列入黑名单,小米港股开盘暴跌11任期只有六天,但是特朗普政府已决定将另一家中国电子巨头放在黑名单上世界第三大手机制造商小米。美国国防部现将小米指定为中国军事公司,这意味着它现在容易受到特朗普禁止美国投资此类公司的LCD党等到了,RedmiK30s已入网,定价比预期更低前段时间小米海外发布的小米10T的国行版,在今天正式入网,与猜测一样给到了Redmi,至于命名是K30S还是K30T暂不确定,不过从配置来看这款手机定位是与K30Ultra一个级别3299起,聊聊小米10S优势在哪小米10的基础配置,小米10Pro的双扬声器小米11的配色及哈曼卡顿音效小米10Ultra的ID设计,再加上骁龙870处理器,可以说小米10S是将历代好评的配置全部汇聚在一起,那么Windows电脑有哪些必装软件?这10款电脑神器,神了推荐10款免安装的电脑神器!免费看片儿官方电子书一键清理电脑快速检索文件每一款都强大的不得了!一便携版免安装工具1电脑清理工具GlaryUtilities便携版免安装!一款简洁但强
三点理由即便6499元,一加8Pro依然物超所值虽说一加8系列要到后天(4月16日晚上19点)的发布会上才知道最终定价,但网上已经传出不少版本。线下渠道显示一加8Pro的预订价是6499元欧洲市场传言相比去年同期产品,全系价格上长城皮卡再次登顶!3月市场占有率近50,网友豪横!中国汽车市场向来是兵家必争之地,全球排名前50的品牌都在中国市场有所涉猎,每年上市新车超300款,在这百家争鸣的春秋战国,所有车企都在相互追赶,以求更大的市场占额。但在竞争如此激烈双模迅速切换,平板振膜降维打击HIFIMANDEVA产品实测在整个耳机市场都在割TWS耳机的韭菜的时候,HIFIMAN在TWS耳机市场上凭借TWS600和TWS600A两款产品大杀四方的同时,还在自家入门级的大耳DEVA上加上一个蓝牙模块的简测CHOETECH65W氮化镓PD快充头今年手机圈的充电速度比拼大赛打的是如火如荼,各家充电设备厂商也纷纷推出了高功率的快充头,而氮化镓技术在传统的快充头中闪耀而出。最近正好收到了CHOETECH(迪奥科)的65W氮化镓性价比最佳之选余音BR3大家好,今天给大家带来的是余音BR3这款挂脖式蓝牙耳机。由于产品还未发售,所以寄来的是裸装版,这边开箱的环节就跳过了,让我们来直接看看这款耳机吧!设计上很精巧,挂脖式的设计很适合我这款收音设备值得被吹爆!塞宾智能麦克风SmartMike初体验在短视频占据了大部分媒体资源的时代,Vlog成为了很多人代替之前发微博这类短文字的方式,更全面的表达方式也代表着更多的设备需求,今天给大家带来的就是一款Vlog神器塞宾智麦(Sma征拓ZendureS3目前最好的氮化镓充电器选择!大家好呀,今天给大家带来的评测是征拓Zendure家寄来的氮化镓65W充电头SuperPortS3(下面简称S3)!那么可能很多人对Zendure征拓这个品牌不了解,我就先给大家介百元耳机不能拥有好方案?潜韵TS03来告诉你!大家好呀,今天给大家带来的是这款潜韵家新出的TWS耳机潜韵TS03!那么潜韵这个公司相比不用过多的给大家介绍了吧!潜韵在前两年的国内百元耳机市场做的可是风生水起,凭借一手潜99打出千元耳机想要又帅又毒?TFZKINGEDITION安排上大家好,今天给大家带来的是TFZKINGEDITION这条千元级别的耳机!TFZ锦瑟香也在国内HIFI圈也是知名厂商了,他们家的一些HIFI耳机做的是真的很不错,毕竟好产品才会有好国产汽车的未来!4月卖出8万台,长城汽车用销量来证明提及长城汽车,大家首先联想到的一定是它长期居高不下的销量。没错,长城汽车作为自主品牌里的老大哥,在市场中一直有着不少关于它的传奇故事,比如,常年坐拥市场占有率第一连年蝉联销量冠军但最详细WWDC20发布会总览!苹果真正独步天下的时代即将开始今年的WWDC苹果不仅带来了五大操作系统的升级更新,还正式发布了苹果自主研发基于ARM架构的电脑处理器。我们先来讲讲操作系统的更新首先登场的是全新的iOS14,此次iOS14的升级