Inputs
The Input_Reader class is the base object to read different file formats
Input_Reader
Source code in python\engine\inputs.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
|
filegdb(file, layername)
A function that read a layer from an ESRI File Geodatabase using the OpenFileGDB driver.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file
|
string
|
The path to the file geodatabase to read. |
required |
layername
|
string
|
The layer to load from the database. |
required |
Returns:
Name | Type | Description |
---|---|---|
layer |
QgsVectorLayer
|
A QgsVectorLayer object containing the data |
Source code in python\engine\inputs.py
113 114 115 116 117 118 119 120 121 122 123 124 125 |
|
geojson(filepath)
A function that reads a GeoJson file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filepath
|
string
|
The path to the GeoJson file to read |
required |
Returns:
Name | Type | Description |
---|---|---|
layer |
QgsVectorLayer
|
A QgsVectorLayer object containing data from the GeoJson file. |
Source code in python\engine\inputs.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
|
geopackage(file, layername)
A function that reads alayer from a Geopackage file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file
|
string)
|
The path to the geopackage file to read |
required |
Layername
|
string
|
The layer to load from the Geopackage |
required |
Returns:
Name | Type | Description |
---|---|---|
layer |
QgsVectorLayer
|
A QgsVectorLayer object containing data from the geopackage. |
Source code in python\engine\inputs.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
|
mssql(connection, dbname, schema, table, geometryname='Geometri')
A function that reads a layer from a MSSQL database
Parameters:
Name | Type | Description | Default |
---|---|---|---|
connection
|
string
|
connection name in settings |
required |
dbname
|
string
|
database name |
required |
schema
|
string
|
schema name |
required |
table
|
string
|
table name |
required |
geometryname
|
(string, optional)
|
name of geometry column. defaults to "geom" |
'Geometri'
|
Returns:
Type | Description |
---|---|
A QgsVectorLayer object containing data from the postgis database |
Source code in python\engine\inputs.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
|
postGIS(connection, dbname, schema, table, geometryname='geom')
A function that reads a layer from a PostGIS database
Parameters:
Name | Type | Description | Default |
---|---|---|---|
connection
|
string
|
connection name in settings |
required |
dbname
|
string
|
database name |
required |
schema
|
string
|
schema name |
required |
table
|
string
|
table name |
required |
geometryname
|
(string, optional)
|
name of geometry column. defaults to "geom" |
'geom'
|
Returns:
Type | Description |
---|---|
A QgsVectorLayer object containing data from the postgis database |
Source code in python\engine\inputs.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
|
shapefile(filepath)
A function that reads a shapefile
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filepath
|
string
|
The path to the shapefile to read |
required |
Returns:
Name | Type | Description |
---|---|---|
layer |
QgsVectorLayer
|
A QgsVectorLayer containing data from the shapefile. |
Source code in python\engine\inputs.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
sqlDB(db_type, connection, dbname, schema, table, geometryname='geom')
A function that reads a layer from a SQL database
Parameters:
Name | Type | Description | Default |
---|---|---|---|
db_type
|
string
|
Type of SQL database. Postgres and MSSQL supported. |
required |
connection
|
string
|
connection name in settings |
required |
dbname
|
string
|
database name |
required |
schema
|
string
|
schema name |
required |
table
|
string
|
table name |
required |
geometryname
|
(string, optional)
|
name of geometry column. defaults to "geom" |
'geom'
|
Returns:
Type | Description |
---|---|
A QgsVectorLayer object containing data from the postgis database |
Source code in python\engine\inputs.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
|
wfs(uri)
A function that reads a WFS service.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uri
|
string
|
The uri can be a HTTP url to a WFS server (http://foobar/wfs?TYPENAME=xxx&SRSNAME=yyy[&FILTER=zzz) or a URI constructed using the QgsDataSourceURI class with the following parameters: - url=string (mandatory): HTTP url to a WFS server endpoint. e.g http://foobar/wfs - typename=string (mandatory): WFS typename - srsname=string (recommended): SRS like ‘EPSG:XXXX’ - username=string - password=string - authcfg=string - version=auto/1.0.0/1.1.0/2.0.0 -sql=string: full SELECT SQL statement with optional WHERE, ORDER BY and possibly with JOIN if supported on server - filter=string: QGIS expression or OGC/FES filter - restrictToRequestBBOX=1: to download only features in the view extent (or more generally in the bounding box of the feature iterator) - maxNumFeatures=number - IgnoreAxisOrientation=1: to ignore EPSG axis order for WFS 1.1 or 2.0 - InvertAxisOrientation=1: to invert axis order - hideDownloadProgressDialog=1: to hide the download progress dialog |
required |
Returns:
Name | Type | Description |
---|---|---|
layer |
QgsVectorLayer
|
A QgsVectorLayer object containing data from the WFS service. |
Source code in python\engine\inputs.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
|