27.2.8. 向量杂项
27.2.8.1. 构建虚拟矢量
创建包含一组矢量层的虚拟矢量层。输出虚拟矢量层将不会在当前项目中打开。
此算法在另一种算法需要多个层但只接受一个层的情况下特别有用 vrt
其中指定了层。
参数
标签 |
名字 |
类型 |
描述 |
---|---|---|---|
Input datasources |
|
[vector: any] [list] |
选择要用于构建虚拟矢量的矢量图层 |
Create "unioned" VRT |
|
[boolean] 默认:FALSE |
如果要将所有向量合并到一个 |
Virtual vector |
|
[same as input] 默认: |
指定仅包含副本的输出层。以下选项之一:
|
产出
标签 |
名字 |
类型 |
描述 |
---|---|---|---|
Virtual vector |
|
[vector: any] |
从所选源生成的输出虚拟向量 |
Python代码
Algorithm ID : gdal:buildvirtualvector
import processing
processing.run("algorithm_id", {parameter_dictionary})
这个 algorithm id 当您将鼠标悬停在处理工具箱中的算法上时,将显示。这个 parameter dictionary 提供参数名称和值。看见 从控制台使用处理算法 有关如何从Python控制台运行处理算法的详细信息。
27.2.8.2. 执行SQL
在源层上运行使用SQL语法的简单或复杂查询。查询结果将作为新层添加。
此算法是从 GDAL ogr2ogr utility 。
参数
基本参数
标签 |
名字 |
类型 |
描述 |
---|---|---|---|
Input layer |
|
[vector: any] |
支持OGR的输入向量层 |
SQL expression |
|
[string] |
定义SQL查询,例如 |
SQL dialect |
|
[enumeration] 默认:0 |
要使用的SQL方言。以下选项之一:
|
SQL result |
|
[vector: any] |
输出层的规范。以下选项之一:
为 |
高级参数
标签 |
名字 |
类型 |
描述 |
---|---|---|---|
Additional creation options 任选 |
|
[string] 默认值:‘’(无其他选项) |
其他GDAL创建选项。 |
产出
标签 |
名字 |
类型 |
描述 |
---|---|---|---|
SQL result |
|
[vector: any] |
由查询创建的矢量图层 |
Python代码
Algorithm ID : gdal:executesql
import processing
processing.run("algorithm_id", {parameter_dictionary})
这个 algorithm id 当您将鼠标悬停在处理工具箱中的算法上时,将显示。这个 parameter dictionary 提供参数名称和值。看见 从控制台使用处理算法 有关如何从Python控制台运行处理算法的详细信息。
27.2.8.3. 导出到PostgreSQL(可用连接)
基于可用连接在PostgreSQL数据库内导入矢量图层。这一连接必须 be defined properly 在此之前。请注意,‘保存用户名’和‘保存密码’复选框处于激活状态。然后你就可以使用这个算法了。
此算法是从 GDAL ogr2ogr utility 。
参数
标签 |
名字 |
类型 |
描述 |
---|---|---|---|
Database (connection name) |
|
[string] |
要连接的PostgreSQL数据库 |
Input layer |
|
[vector: any] |
要导出到数据库的OGR支持的矢量图层 |
Shape encoding 任选 |
|
[string] 默认:‘’ |
设置要应用于数据的编码 |
Output geometry type |
|
[enumeration] 默认:0 |
定义输出几何图形类型。以下选项之一:
|
Assign an output CRS 任选 |
|
[crs] 默认:无 |
定义数据库表的输出CRS |
Reproject to this CRS on output 任选 |
|
[crs] 默认:无 |
在输出时重新投影/转换到此CRS |
Override source CRS 任选 |
|
[crs] 默认:无 |
覆盖输入图层CRS |
Schema (schema name) 任选 |
|
[string] 默认值:‘PUBLIC’ |
定义数据库表的架构 |
Table to export to (leave blank to use layer name) 任选 |
|
[string] 默认:‘’ |
定义将导入到数据库中的表的名称。默认情况下,表名称为输入向量文件的名称。 |
Primary Key (new field) 任选 |
|
[string] 默认:‘ID’ |
定义哪个属性字段将作为数据库表的主键 |
Primary Key (existing field, used if the above option is left empty) 任选 |
|
[tablefield: any] 默认:无 |
定义导出的图层中的哪个属性字段将作为数据库表的主键 |
Geometry column name 任选 |
|
[string] 默认:‘Geom’ |
定义将在数据库的哪个属性字段中存储几何信息 |
Vector dimensions 任选 |
|
[enumeration] 默认:0(2D) |
定义要导入的矢量文件是否包含2D或3D数据。以下选项之一:
|
Distance tolerance for simplification 任选 |
|
[string] 默认:‘’ |
为要导入的矢量几何图形的简化定义距离公差。默认情况下,不会进行简化。 |
Maximum distance between 2 nodes (densification) 任选 |
|
[string] 默认:‘’ |
两个节点之间的最大距离。用于创建中间点。默认情况下,不存在致密化。 |
Select features by extent (defined in input layer CRS) 任选 |
|
[extent] 默认:无 |
您可以从输出表中的给定范围中选择要素。 可用的方法包括:
|
Clip the input layer using the above (rectangle) extent 任选 |
|
[boolean] 默认:FALSE |
输入图层将按您之前定义的范围进行裁剪 |
Select features using a SQL "WHERE" statement (Ex: column="value") 任选 |
|
[string] 默认:‘’ |
使用SQL“WHERE”语句定义应从输入图层中选择哪些要素 |
Group N features per transaction (Default: 2000) 任选 |
|
[string] 默认:‘’ |
您可以在N定义大小的事务中对输入要素进行分组。默认情况下,N将事务大小限制为20000个要素。 |
Overwrite existing table 任选 |
|
[boolean] 默认值:True |
如果数据库中存在同名的表,并且此选项设置为True,则该表将被覆盖。 |
Append to existing table 任选 |
|
[boolean] 默认:FALSE |
如果选中/True,则向量数据将追加到现有表中。在输入层中找到的新字段将被忽略。默认情况下,将创建一个新表。 |
Append and add new fields to existing table 任选 |
|
[boolean] 默认:FALSE |
如果激活,矢量数据将被追加到现有的表中,不会创建新的表。在输入图层中找到的新字段将添加到表中。默认情况下,将创建一个新表。 |
Do not launder columns/table names 任选 |
|
[boolean] 默认:FALSE |
选中此选项后,您可以防止默认行为(将列名转换为小写、删除空格和其他无效字符)。 |
Do not create Spatial Index 任选 |
|
[boolean] 默认:FALSE |
防止为输出表创建空间索引。默认情况下,会添加空间索引。 |
Continue after a failure, skipping the failed feature 任选 |
|
[boolean] 默认:FALSE |
|
Promote to Multipart 任选 |
|
[boolean] 默认值:True |
在输出表中将要素几何类型转换为多部分 |
Keep width and precision of input attributes 任选 |
|
[boolean] 默认值:True |
避免修改列属性以符合输入数据 |
Additional creation options 任选 |
|
[string] 默认值:‘’(无其他选项) |
其他GDAL创建选项。 |
产出
该算法没有输出。
Python代码
Algorithm ID : gdal:importvectorintopostgisdatabaseavailableconnections
import processing
processing.run("algorithm_id", {parameter_dictionary})
这个 algorithm id 当您将鼠标悬停在处理工具箱中的算法上时,将显示。这个 parameter dictionary 提供参数名称和值。看见 从控制台使用处理算法 有关如何从Python控制台运行处理算法的详细信息。
27.2.8.4. 导出到PostgreSQL(新连接)
导入PostgreSQL数据库内的矢量层。必须创建到PostGIS数据库的新连接。
此算法是从 GDAL ogr2ogr utility 。
参数
标签 |
名字 |
类型 |
描述 |
---|---|---|---|
Input layer |
|
[vector: any] |
要导出到数据库的OGR支持的矢量图层 |
Shape encoding 任选 |
|
[string] 默认:‘’ |
设置要应用于数据的编码 |
Output geometry type |
|
[enumeration] 默认:0 |
定义输出几何图形类型。以下选项之一:
|
Assign an output CRS 任选 |
|
[crs] 默认:无 |
定义数据库表的输出CRS |
Reproject to this CRS on output 任选 |
|
[crs] 默认:无 |
在输出时重新投影/转换到此CRS |
Override source CRS 任选 |
|
[crs] 默认:无 |
覆盖输入图层CRS |
Host 任选 |
|
[string] 默认值:‘localhost’ |
数据库主机的名称 |
Port 任选 |
|
[string] 默认:‘5432’ |
PostgreSQL数据库服务器监听的端口号 |
Username 任选 |
|
[string] 默认:‘’ |
用于登录到数据库的用户名 |
Database name 任选 |
|
[string] 默认:‘’ |
数据库的名称 |
Password 任选 |
|
[string] 默认:‘’ |
与用户名一起使用以连接到数据库的密码 |
Schema (schema name) 任选 |
|
[string] 默认值:‘PUBLIC’ |
定义数据库表的架构 |
Table name, leave blank to use input name 任选 |
|
[string] 默认:‘’ |
定义将导入到数据库中的表的名称。默认情况下,表名称为输入向量文件的名称。 |
Primary Key (new field) 任选 |
|
[string] 默认:‘ID’ |
定义哪个属性字段将作为数据库表的主键 |
Primary Key (existing field, used if the above option is left empty) 任选 |
|
[tablefield: any] 默认:无 |
定义导出的图层中的哪个属性字段将作为数据库表的主键 |
Geometry column name 任选 |
|
[string] 默认:‘Geom’ |
定义要在哪个属性字段中存储几何信息 |
Vector dimensions 任选 |
|
[enumeration] 默认:0(2D) |
定义要导入的矢量文件是否包含2D或3D数据。以下选项之一:
|
Distance tolerance for simplification 任选 |
|
[string] 默认:‘’ |
为要导入的矢量几何图形的简化定义距离公差。默认情况下,不会进行简化。 |
Maximum distance between 2 nodes (densification) 任选 |
|
[string] 默认:‘’ |
两个节点之间的最大距离。用于创建中间点。默认情况下,不存在致密化。 |
Select features by extent (defined in input layer CRS) 任选 |
|
[extent] 默认:无 |
您可以从输出表中的给定范围中选择要素。 可用的方法包括:
|
Clip the input layer using the above (rectangle) extent 任选 |
|
[boolean] 默认:FALSE |
输入图层将按您之前定义的范围进行裁剪 |
Fields to include (leave empty to use all fields) 任选 |
|
[string] [list] 默认:[] |
定义要从导入的矢量文件中保留的字段。如果未选择任何选项,则会导入所有字段。 |
Select features using a SQL "WHERE" statement (Ex: column="value") 任选 |
|
[string] 默认:‘’ |
使用SQL“WHERE”语句定义应为输出表选择哪些要素 |
Group N features per transaction (Default: 2000) 任选 |
|
[string] 默认:‘’ |
您可以在N定义大小的事务中对输入要素进行分组。默认情况下,N将事务大小限制为20000个要素。 |
Overwrite existing table 任选 |
|
[boolean] 默认值:True |
如果数据库中存在同名的表,并且此选项设置为True,则该表将被覆盖。 |
Append to existing table 任选 |
|
[boolean] 默认:FALSE |
如果选中/True,则向量数据将追加到现有表中。在输入层中找到的新字段将被忽略。默认情况下,将创建一个新表。 |
Append and add new fields to existing table 任选 |
|
[boolean] 默认:FALSE |
如果激活,矢量数据将被追加到现有的表中,不会创建新的表。在输入图层中找到的新字段将添加到表中。默认情况下,将创建一个新表。 |
Do not launder columns/table names 任选 |
|
[boolean] 默认:FALSE |
选中此选项后,您可以防止默认行为(将列名转换为小写、删除空格和其他无效字符)。 |
Do not create Spatial Index 任选 |
|
[boolean] 默认:FALSE |
防止为输出表创建空间索引。默认情况下,会添加空间索引。 |
Continue after a failure, skipping the failed feature 任选 |
|
[boolean] 默认:FALSE |
|
Promote to Multipart 任选 |
|
[boolean] 默认值:True |
在输出表中将要素几何类型转换为多部分 |
Keep width and precision of input attributes 任选 |
|
[boolean] 默认值:True |
避免修改列属性以符合输入数据 |
Additional creation options 任选 |
|
[string] 默认值:‘’(无其他选项) |
其他GDAL创建选项。 |
产出
该算法没有输出。
Python代码
Algorithm ID : gdal:importvectorintopostgisdatabasenewconnection
import processing
processing.run("algorithm_id", {parameter_dictionary})
这个 algorithm id 当您将鼠标悬停在处理工具箱中的算法上时,将显示。这个 parameter dictionary 提供参数名称和值。看见 从控制台使用处理算法 有关如何从Python控制台运行处理算法的详细信息。
27.2.8.5. 向量信息
创建列出有关受OGR支持的数据源的信息的信息文件。输出将显示在“结果”窗口中,并可以写入到一个HTML文件中。这些信息包括几何类型、特征计数、空间范围、投影信息等。
此算法是从 GDAL ogrinfo utility 。
参数
标签 |
名字 |
类型 |
描述 |
---|---|---|---|
Input layer |
|
[vector: any] |
输入向量层 |
Summary output only 任选 |
|
[boolean] 默认值:True |
|
Suppress metadata info 任选 |
|
[boolean] 默认:FALSE |
|
Layer information |
|
[html] 默认: |
指定包含文件信息的输出HTML文件。以下选项之一:
如果未定义HTML文件,则输出将写入临时文件 |
产出
标签 |
名字 |
类型 |
描述 |
---|---|---|---|
Layer information |
|
[html] |
包含文件信息的输出HTML文件。 |
Python代码
Algorithm ID : gdal:ogrinfo
import processing
processing.run("algorithm_id", {parameter_dictionary})
这个 algorithm id 当您将鼠标悬停在处理工具箱中的算法上时,将显示。这个 parameter dictionary 提供参数名称和值。看见 从控制台使用处理算法 有关如何从Python控制台运行处理算法的详细信息。