QGIS 3中是否有一种方法来获取所选功能WKT?


Answers:


12

我不确定这是否实际上是QGIS 2.x的一部分,因为我一直使用getWKT插件。但是可以从“识别”窗口上下文菜单访问WKT: 在此处输入图片说明

结果:

wkt_geom    id  OBJECTID    ID_0    ISO NAME_0  ID_1    NAME_1  ID_2    NAME_2  HASC_2  CCN_2   CCA_2   TYPE_2  ENGTYPE_2   NL_NAME_2   VARNAME_2   Shape_Length    Shape_Area
MultiPolygon (((-86.1056060791015625 34.20109939575195313, -86.10605621337890625 34.22154998779296875, -86.10604095458984375 34.22610092163091622, -86.10703277587890625 34.25019073486328125, -86.10832214355457381 34.32471084594732247, -86.10830688476556816 34.32788848876958809, -86.1097869873046875 34.36470031738286934, -86.10974121093744316 34.37469863891607247, -86.11003112792963066 34.42784881591802559, -86.05683135986328125 34.47628021240240059, -86.04846954345703125 34.47669982910167619, -86.03733062744134941 34.47574996948242188, -86.03174591064453125 34.47526931762706681, -86.02672576904296875 34.47661209106456681, -86.02169036865228691 34.48067855834960938, -86.0177764892578125 34.48247909545904122, -86.01275634765619316 34.48200988769536934, -86.00663757324213066 34.48107147216808244, -86.00216674804681816 34.48196029663097306, -85.99098205566400566 34.48736953735351563, -85.98596954345703125 34.48688888549816056, -85.9837188720703125 34.490509033203125, -85.97757720947265625 34.49139022827148438, -85.96972656249994316 34.4968109130859375, -85.96190643310541191 34.49950027465831681, -85.95966339111328125 34.50222015380865059, -85.9568328857421875 34.507659912109375, -85.9383087158203125 34.52527999877924003, -85.9231719970703125 34.53520965576177559, -85.91980743408203125 34.53701019287103691, -85.91082763671875 34.54423141479492188, -85.881683349609375 34.5622406005859375, -85.86540985107416191 34.57260894775396309, -85.839019775390625 34.5897216796875, -85.8244171142578125 34.59962844848644181, -85.81993103027332381 34.60187911987310372, -85.81488037109375 34.60548019409185372, -85.81262969970703125 34.60683059692388497, -85.78566741943353691 34.62438201904296875, -85.76193237304681816 34.65375900268560372, -85.73532867431634941 34.68856048583990059, -85.733062744140625 34.69173049926763497, -85.72173309326171875 34.70664978027349434, -85.71833801269525566 34.7102508544921875, -85.69338226318359375 34.74415206909185372, -85.67267608642572441 34.74536895751958809, -85.65912628173822441 34.75661849975597306, -85.64827728271484375 34.77561950683588066, -85.63632965087884941 34.79415130615234375, -85.63404083251947441 34.79867935180669747, -85.634002685546875 34.80186080932617188, -85.63387298583984375 34.81412124633789063, -85.62696075439453125 34.83042144775390625, -85.60381317138666191 34.84749984741210938, -85.603759765625 34.85113143920904122, -85.60205078125 34.85338973999023438, -85.5970001220703125 34.85425949096691056, -85.58358764648431816 34.86230087280284806, -85.57299804687494316 34.80289077758794747, -85.53456878662103691 34.62474060058605119, -85.5322265625 34.61392974853515625, -85.52683258056634941 34.58852005004888497, -85.51317596435546875 34.52474975585948869, -85.52217102050775566 34.52661895751958809, -85.52498626708984375 34.52347183227544747, -85.52558898925775566 34.52074050903320313, -85.52284240722650566 34.51708984375005684, -85.52731323242181816 34.51713180541992188, -85.53235626220703125 34.51490020751953125, -85.53459930419921875 34.51354980468744316, -85.535186767578125 34.51082992553710938, -85.5408172607421875 34.50632858276372872, -85.54480743408203125 34.50001144409185372, -85.5475921630859375 34.500030517578125, -85.5509033203125 34.50323867797857247, -85.55480194091791191 34.50371932983409806, -85.55871582031238631 34.50239181518549003, -85.55771636962890625 34.49238967895513497, -85.559417724609375 34.49058914184570313, -85.56835174560535506 34.48974990844737931, -85.57063293457025566 34.4861297607421875, -85.5767822265625 34.48390960693365059, -85.57459259033203125 34.48070907592773438, -85.57350158691394881 34.47888946533203125, -85.57071685791009941 34.47795867919927559, -85.5702972412109375 34.46704864501953125, -85.57639312744140625 34.47072982788080253, -85.5808563232421875 34.46986007690435372, -85.577606201171875 34.46165847778325997, -85.57930755615228691 34.45940017700200997, -85.58377075195306816 34.45851898193365059, -85.57946014404296875 34.44622039794916191, -85.57897186279296875 34.44031143188482247, -85.5818023681640625 34.43669891357421875, -85.58351898193359375 34.43307876586919747, -85.59079742431640625 34.42950057983409806, -85.58863067626947441 34.42494201660161934, -85.600921630859375 34.42140197753917619, -85.59931945800775566 34.41548156738292619, -85.60381317138666191 34.41324996948247872, -85.60716247558582381 34.4119110107421875, -85.60830688476551131 34.4082794189453125, -85.61112213134765625 34.40649032592773438, -85.61458587646478691 34.39514923095703125, -85.6173858642578125 34.39381027221691056, -85.62680816650379256 34.39797210693353691, -85.62740325927734375 34.39480209350597306, -85.62464141845703125 34.39295959472667619, -85.61968994140625 34.38747024536138497, -85.624755859375 34.38251113891607247, -85.62754058837884941 34.38253021240234375, -85.63034820556640625 34.380279541015625, -85.62818145751953125 34.37525939941417619, -85.62819671630859375 34.3730010986328125, -85.632110595703125 34.37211990356439628, -85.635498046875 34.36804962158203125, -85.63662719726556816 34.36669921875, -85.64108276367181816 34.366729736328125, -85.64272308349603691 34.36946868896490059, -85.6449432373046875 34.36994171142578125, -85.64778900146473006 34.36405181884765625, -85.66282653808588066 34.36280059814458809, -85.6684417724609375 34.35874938964849434, -85.66848754882801131 34.35466003417980119, -85.67241668701171875 34.35150909423833809, -85.676361083984375 34.34698867797851563, -85.67472076416015625 34.34379959106450997, -85.67865753173822441 34.34019088745122872, -85.77178192138671875 34.26084136962890625, -85.7779083251953125 34.25905990600585938, -85.80847930908197441 34.25923919677740059, -85.80921173095697441 34.23971176147472306, -85.81086730957019881 34.23971939086925431, -85.81755828857421875 34.23884963989257813, -85.8253173828125 34.24071884155273438, -85.83030700683588066 34.24164962768566056, -85.8436279296875 34.24444961547857247, -85.84343719482421875 34.19992065429693184, -86.01341247558588066 34.19984054565441056, -86.02507781982421875 34.19989013671880684, -86.04508209228509941 34.19997024536138497, -86.06896209716796875 34.20051956176757813, -86.09284210205072441 34.20059967041015625, -86.10173034667963066 34.20109176635742188, -86.1056060791015625 34.20109939575195313)))  25  25  244 USA United States   1   Alabama 25  De Kalb US.AL.DA    0       County  County          2.16771912642183    0.197712887515082

更新:
可以在以下位置修改复制功能的行为Options | Data Sources | Feature attributes and table | Copy features as
在此处输入图片说明

因此,如果将其设置为GeoJson或不设置任何几何图形,则需要使用辅助选项来获取WKT(请参阅此问题的其他答案)。


2
您也可以在QGIS 2.x中或在2.18中进行:)
Joseph

1
谢谢!这并不令我感到惊讶-可能有很多插件使核心功能模糊不清的情况。
周杰伦·康明斯

7

不知道这是否满足您的需求,但是您可以(并且总是可以)通过添加以下内容的虚拟层来从字段计算器获得WKT:

geomToWKT( $geometry )

在此处输入图片说明


6

您还可以在Python控制台中使用以下命令(尽管您的方法会更快):

layer = iface.activeLayer()
for feat in layer.selectedFeatures():
    print(feat.geometry().asWkt())


2

获得WKT的方法有很多,例如使用前面提到的表达式创建一个字段(虚拟的或不虚拟的)。

但是对于您有关QuickWKT的原始问题,此插件已移植到QGIS3。请检查您的插件管理器。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.