收藏 分销(赏)

用python写fme数据转换脚本.docx

上传人:仙人****88 文档编号:12023994 上传时间:2025-08-29 格式:DOCX 页数:2 大小:15.30KB 下载积分:10 金币
下载 相关 举报
用python写fme数据转换脚本.docx_第1页
第1页 / 共2页
用python写fme数据转换脚本.docx_第2页
第2页 / 共2页
本文档共2页,全文阅读请下载到手机保存,查看更方便
资源描述
用python写fme数据转换脚本 学了几天的python和FME Objects,发现之间教程里的很多对象已经过时了,而且语法和vb相差比较大,但概念还是一样的,下面写一段python代码,将这几天学习的对象联系一下,下面的代码功能是读schema feature和data feature,并显示feature的属性和关联的坐标系,并使用FMEDialog对象来设置源和目标,并做格式转换,一下代码经过测试,运行正常。 import pyfme FME_GEOMETRY_TYPE={     0:"FME_GEOM_UNDEFINED",     1:"FME_GEOM_POINT",     2:"FME_GEOM_LINE",     4:"FME_GEOM_POLYGON",     8:"FME_GEOM_DONUT",     256:"FME_GEOM_PIP",     512:"FME_GEOM_AGGREGATE",     } session=pyfme.FMESession() dialog=session.createDialog() pr=dialog.sourcePrompt("","") reader=pyfme.FMEReader(pr[0]) reader.open(pr[1],pr[2]) pw=dialog.destPrompt("","") writer=pyfme.FMEWriter(pw[0]) writer.open(pw[1],pw[2]) theend=True while theend:     feature=pyfme.FMEFeature()     theend=reader.readSchema(feature)     if theend:         print "\n------------%s----------" % "Schema Feature Infomation"         print "Geometry Type: " + str(FME_GEOMETRY_TYPE[feature.getGeometryType()])         print "Feature Type: " + str(feature.getFeatureType())         print "CoordinateSystem Name: " + feature.getCoordinateSystem()         csm=pyfme.FMECoordSysManager()         csp=csm.getOGCCoordSys(feature.getCoordinateSystem())         print "CoordinateSystem Information:\n%s\n" % csp         writer.addSchema(feature) theend=True while theend:     feature=pyfme.FMEFeature()     theend=reader.read(feature)     if theend:         print "\n------------%s----------\n" % "Data Feature Infomation"         print "GeometryType: " + str(FME_GEOMETRY_TYPE[feature.getGeometryType()])         print "FeatureType: " + str(feature.getFeatureType())         print "CoordinateSystem: " + feature.getCoordinateSystem()         print "CoordinateSystem List:\n%s\n" % feature.getCoordinates()         writer.write(feature) reader.close() writer.close() del reader del writer 运行环境 FME DESKTOP 2009 ,pyfme for python 2.5,python 2.5
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传

当前位置:首页 > 包罗万象 > 大杂烩

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2026 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服