简体   繁体   English

使用PYQGIS将2个dbf文件与公共列(id)联接

[英]Using PYQGIS to join 2 dbf files with common column(id)

I am new to QGIS and Python. 我是QGIS和Python的新手。 I need to join 2dbf files using QGIS and Python to create a shapefile.The 2 dbf files have a common column(id). 我需要使用QGIS和Python连接2dbf文件以创建shapefile.2 dbf文件具有相同的column(id)。 Can someone give me an idea how i can join the dbf files to produce 1 shapefile? 有人可以给我一个想法,我怎么能加入DBF文件,每生产1个shape文件? What library can i use for the same? 我可以将哪个库用于同一库?

Since there are no other answers, I'll offer my solution with batch joining 2 or more files using DBF Commander Professional . 由于没有其他答案,因此我将使用DBF Commander Professional批量加入2个或更多文件来提供我的解决方案。

Install the app, then create a BAT file that contains SQL commands as follows: 安装应用程序,然后创建一个包含SQL命令的BAT文件,如下所示:

"c:\Program Files\DBFCommander\DBFCommander.exe" -q "INSERT INTO 'D:\destination.dbf' SELECT * FROM 'D:\source.dbf'"

Type as much commands as you need, or use a loop to find all DBF files in the folder. 键入所需数量的命令,或使用循环查找文件夹中的所有DBF文件。 Then run the BAT file. 然后运行BAT文件。 Remember, all DBF files should be of the same structure (field names and types). 请记住,所有DBF文件都应具有相同的结构(字段名称和类型)。

The app has full-featured 20-days trial period, so you can carry out this operation for free. 该应用程序具有功能齐全的20天试用期,因此您可以免费进行此操作。 More info on using DBF Commander Pro in a batch mode you can find here . 您可以在此处找到有关以批处理模式使用DBF Commander Pro的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM