geodata
add_info(metadata, info)
¶
Add the :py:func:ogrinfo output to the metadata returned by
:py:func:download_extract.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metadata
|
dict
|
Metadata returned by :py:func: |
required |
info
|
dict
|
:py:func: |
required |
Source code in packages/common/src/bag3d/common/utils/geodata.py
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
attributes_dict(attributes_str)
¶
[ { "name": attribute name, "type": value type, "constraints" value constraints }, ... ]
Source code in packages/common/src/bag3d/common/utils/geodata.py
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 | |
bbox_from_wkt(wkt)
¶
Returns the BBOX of a WKT Polygon.
Source code in packages/common/src/bag3d/common/utils/geodata.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |
ogr2postgres(gdal_runner, dsn, dataset, extract_path, feature_type, xsd, new_table, context=None)
¶
ogr2ogr a layer from zipped data extract from GML into Postgres.
It was developed for loading the TOP10NL and BGT extracts that are downloaded from the PDOK API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gdal_runner
|
CommandRunner
|
CommandRunner for GDAL tools. |
required |
dsn
|
str
|
PostgreSQL connection string. |
required |
dataset
|
str
|
Name of the dataset ('top10nl', 'bgt'). |
required |
extract_path
|
Path
|
Local path to the zipped extract. |
required |
feature_type
|
str
|
The feature layer to load from the |
required |
xsd
|
str
|
Path (URL) to the XSD file. |
required |
new_table
|
PostgresTableIdentifier
|
The name of the new Postgres table to load the data into. |
required |
context
|
OpExecutionContext
|
Optional op execution context from Dagster for metadata retrieval. |
None
|
Returns:
Runs :py:func:postgrestable_metadata on return and returns a dict of metadata
of the new_table loaded with data.
Source code in packages/common/src/bag3d/common/utils/geodata.py
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
ogrinfo(gdal_runner, dataset, extract_path, feature_types, xsd, context=None)
¶
Runs ogrinfo on the zipped extract.
Source code in packages/common/src/bag3d/common/utils/geodata.py
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 | |
parse_ogrinfo(ogrinfo_stdout, feature_type)
¶
Parses the stdout of ogrinfo into a dictionary.
Source code in packages/common/src/bag3d/common/utils/geodata.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
parse_ogrinfo_attributes(attributes_str)
¶
Parses the attributes list of the ogrinfo stdout into a :py:class:TableSchema
Source code in packages/common/src/bag3d/common/utils/geodata.py
110 111 112 113 114 | |
pdal_info(pdal, file_path, with_all=False, verbose=False, context=None)
¶
Run 'pdal info' on a point cloud file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
verbose
|
bool
|
Return stdout/stderr from pdal |
False
|
pdal
|
The pdal runner or AppImage executable. |
required | |
file_path
|
Path
|
Path to the point cloud file. |
required |
with_all
|
bool
|
If true, run |
False
|
context
|
Optional Dagster context for Pipes support. |
None
|
Returns: A tuple of (pdal's return code, parsed pdal info output)
Source code in packages/common/src/bag3d/common/utils/geodata.py
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | |