本文主要是介绍【QGIS如何进行WKT可视化】,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
- 点击插件——python控制台
- 渲染线图层
wkt = 'LINESTRINGZ (405223.79236294992733746767 3294798.52338150842115283012 0, 405250.43677213048795238137 3294767.52838639216497540474 0, 405272.27118375105783343315 3294735.17657975200563669205 0, 405363.4359786735731177032 3294593.48755387123674154282 0, 405416.98199918080354109406 3294510.26617936091497540474 0, 405423.97375943389488384128 3294500.05878190044313669205 0, 405429.83319546864368021488 3294492.38214615778997540474 0, 405437.05121304775821045041 3294483.82196549326181411743 0, 405443.58960416156332939863 3294476.78998307185247540474 0, 405454.67236783250700682402 3294466.17993668420240283012 0, 405461.42297818307997658849 3294460.41138199716806411743 0, 405472.93018033192493021488 3294451.61493424326181411743 0, 405482.66540982510196045041 3294445.07495621684938669205 0, 405497.46857144567184150219 3294436.51373795513063669205 0, 405508.77917935780715197325 3294430.97858170466497540474 0, 405522.4276168558862991631 3294425.34717301186174154282 0, 405533.20697476685745641589 3294421.65094498684629797935 0, 405546.04077603638870641589 3294418.06158951576799154282 0, 405556.76135709136724472046 3294415.70874527888372540474 0, 405569.78876187704736366868 3294413.61035660561174154282 0, 405584.38000943418592214584 3294412.22357682138681411743 0, 405602.75555875099962577224 3294411.89758805185556411743 0, 405622.26697232481092214584 3294413.27979020029306411743 0, 405632.9287765260087326169 3294414.79797867638990283012 0, 405648.97479703224962577224 3294418.13013199670240283012 0, 405656.13196255924412980676 3294420.03595475060865283012 0, 405673.9849899049149826169 3294425.97955826623365283012 0, 405684.9610030854819342494 3294430.52936295513063669205 0, 405697.40381314564729109406 3294436.09558609826490283012 0, 405708.8957565073505975306 3294441.23657730920240283012 0, 405772.62897183716995641589 3294469.74799088295549154282 0, 405804.32379605661844834685 3294483.92676285561174154282 0, 405949.63257291045738384128 3294548.93097428278997540474 0, 405978.14398648648057132959 3294540.61938980873674154282 0, 406044.43176724843215197325 3294440.06274918513372540474 0, 406055.89539029548177495599 3294417.67633560951799154282 0, 406077.41217496147146448493 3294385.03577164560556411743 0, 406071.06580045085866004229 3294355.49158219154924154282 0, 406018.50159146665828302503 3294324.01434830529615283012 0, 406003.53040006000082939863 3294316.54578140983358025551 0, 405989.19196011859457939863 3294309.74353531794622540474 0, 405971.88879849913064390421 3294301.97815445903688669205 0, 405957.72119595890399068594 3294295.97113541467115283012 0, 405940.78155973018147051334 3294289.19318131310865283012 0, 405927.86200406466377899051 3294284.31274918420240283012 0, 405910.41956021514488384128 3294277.86359146982431411743 0, 405739.91956021467922255397 3294213.99957779748365283012 0, 405715.15417935571167618036 3294219.17114762216806411743 0, 405577.24280240468215197325 3294338.17175797279924154282 0, 405532.20978238427778705955 3294368.70136002590879797935 0, 405465.53979947377229109406 3294425.90314225153997540474 0, 405373.07776334212394431233 3294506.40997818717733025551 0, 405339.30957486358238384128 3294536.11133316811174154282 0, 405264.86999966902658343315 3294603.76538590295240283012 0, 405235.12561490450752899051 3294631.66895035561174154282 0, 405136.15601041115587577224 3294728.30878190044313669205 0, 405141.77661587990587577224 3294761.83337906748056411743 0, 405223.79236294992733746767 3294798.52338150842115283012 0)'
# 定义一个矢量图层,第一个参数是URL表示的参数路径,例如:Point?crs=epsg:4326&field=id:integer&field=name:string(20)&index=yes
# 第二个参数是图层名称,第三个是数据源,"memory"表示来自内存,即在程序中动态生成的数据
temp = QgsVectorLayer('LineString?crs=epsg:4545', 'result', 'memory')
# 给QGIS工程的实例添加该图层
QgsProject.instance().addMapLayer(temp)
# 开始编辑图层添加数据,先新建一个Feature,设置Feature的Geometry,然后给图层添加该Feature
temp.startEditing()
geom = QgsGeometry().fromWkt(wkt)
feature = QgsFeature()
feature.setGeometry
这篇关于【QGIS如何进行WKT可视化】的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!