Exporter
api
allowed_extensions = ('qgz', 'qgs')
module-attribute
allowed_output_formats = ('json', 'xml')
module-attribute
app = Flask(__name__)
module-attribute
data_path = os.environ.get('QSL_DATA_ROOT', None)
module-attribute
qgs = QgsApplication([], False)
module-attribute
api_export()
Source code in src/qgis_server_light/exporter/api.py
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 |
|
cli
allowed_extensions = ('qgz', 'qgs')
module-attribute
allowed_output_formats = ('json', 'xml')
module-attribute
qgs = QgsApplication([], False)
module-attribute
cli()
Source code in src/qgis_server_light/exporter/cli.py
20 21 22 |
|
export(project, unify_layer_names_by_group=False, output_format=None)
Source code in src/qgis_server_light/exporter/cli.py
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 |
|
extract
create_style_list(qgs_layer)
Source code in src/qgis_server_light/exporter/extract.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
|
create_unified_short_name(name, path)
Source code in src/qgis_server_light/exporter/extract.py
224 225 226 |
|
decide_sslmode(ssl_mode)
Mapper to map ssl modes from QGIS to plain postgres.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ssl_mode |
int
|
The ssl mode of the datasource. |
required |
Returns:
Type | Description |
---|---|
str
|
The string representation of the ssl mode as it is used by postgres connections. |
Raises: LookupError: If the given ssl mode is not supported.
Source code in src/qgis_server_light/exporter/extract.py
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 |
|
extract(path_to_project, unify_layer_names_by_group=False)
Extract the styles and configuration of the given Qgis project to the given output directory.
Source code in src/qgis_server_light/exporter/extract.py
695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 |
|
extract_entities(project, entity, tree, datasets, path, unify_layer_names_by_group=False, types_from_editor_widget=False)
Source code in src/qgis_server_light/exporter/extract.py
609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 |
|
extract_fields(layer, types_from_editor_widget=False)
Source code in src/qgis_server_light/exporter/extract.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
|
extract_group(group, tree, datasets, path, unify_layer_names_by_group=False, types_from_editor_widget=False)
Collects data pertaining to a QGIS layer tree group.
Source code in src/qgis_server_light/exporter/extract.py
580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 |
|
extract_metadata(project)
Construct a JSON object from the given layers and metadata
Source code in src/qgis_server_light/exporter/extract.py
655 656 657 658 659 660 661 662 663 664 665 666 667 |
|
extract_save_layer(project, child, tree, datasets, path, unify_layer_names_by_group=False, types_from_editor_widget=False)
Save the given layer to the output path.
Source code in src/qgis_server_light/exporter/extract.py
275 276 277 278 279 280 281 282 283 284 285 286 287 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 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 |
|
get_group_short_name(group)
Source code in src/qgis_server_light/exporter/extract.py
543 544 545 546 547 548 549 550 551 552 553 554 555 556 |
|
get_group_title(group)
Source code in src/qgis_server_light/exporter/extract.py
559 560 561 562 563 564 565 566 567 568 |
|
get_layer_short_name(layer)
Source code in src/qgis_server_light/exporter/extract.py
571 572 573 574 575 576 577 |
|
get_project_root(path_to_project)
Returns a Tuple
Source code in src/qgis_server_light/exporter/extract.py
677 678 679 680 681 |
|
obtain_nullable(field)
Source code in src/qgis_server_light/exporter/extract.py
167 168 169 170 171 172 173 |
|
obtain_simple_types_from_editor_widget(field)
We simply mimikri QGIS Server here
TODO: This could be improved alot! Maybe we can also backport that to QGIS core some day?
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field |
QgsField
|
The field of an |
required |
Returns:
Type | Description |
---|---|
str | None
|
Unified type name regarding |
str | None
|
Source code in src/qgis_server_light/exporter/extract.py
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 |
|
obtain_simple_types_json(field)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field |
QgsField
|
The field of an |
required |
Returns:
Name | Type | Description |
---|---|---|
Tuple[str, str] | Tuple[str, None]
|
Unified type name regarding |
|
Tuple[str, str] | Tuple[str, None]
|
||
IMPORTANT |
Tuple[str, str] | Tuple[str, None]
|
If type is not matched within the function it will be |
Source code in src/qgis_server_light/exporter/extract.py
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 |
|
obtain_simple_types_xml(field)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field |
QgsField
|
The field of an |
required |
Returns:
Name | Type | Description |
---|---|---|
str
|
Unified type name regarding |
|
str
|
||
IMPORTANT |
str
|
If type is not matched within the function it will be |
Source code in src/qgis_server_light/exporter/extract.py
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 |
|
prepare_project_name(project)
Source code in src/qgis_server_light/exporter/extract.py
684 685 686 687 688 689 690 691 692 |
|
provide_field_length(field)
Source code in src/qgis_server_light/exporter/extract.py
176 177 178 179 180 181 |
|
provide_field_precision(field)
Source code in src/qgis_server_light/exporter/extract.py
184 185 186 187 188 189 |
|
sanitize_name(raw, lower=False)
Wandelt einen beliebigen String in einen WMS/WFS‑ und URL‑Pfad‑ kompatiblen Layer‑Kurznamen um.
Schritte: 1. Unicode‑NFD → ASCII‑Transliteration (entfernt Umlaute/Diakritika). 2. Alle Zeichen, die NICHT [A‑Za‑z0‑9_.‑] sind, durch '' ersetzen. 3. Mehrere Unterstriche auf einen reduzieren. 4. Führende/abschließende '', '.', '-' entfernen. 5. Falls der Name leer ist ODER nicht mit Buchstabe bzw. '' beginnt, vorne '' voranstellen. 6. Optional alles in Kleinbuchstaben konvertieren (lower=True).
Source code in src/qgis_server_light/exporter/extract.py
512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 |
|
save_to_disk(path_to_output_dir, built)
Source code in src/qgis_server_light/exporter/extract.py
670 671 672 673 674 |
|
funcs
compose(*fs)
Returns the left-to-right composition of any Iterable of functions. Ex: compose(f, g, h)(args, kwargs) == h(g(f(args, **kwargs)))
Source code in src/qgis_server_light/exporter/funcs.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
|
extent_in_wgs84(project, layer)
Reprojects the layer's extent using a custom projection. Returns the coordinates as List of floats.
Source code in src/qgis_server_light/exporter/funcs.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
|
get_layer_type(layer)
Gets the type of the given Qgis layer as a string if the type is supported.
Source code in src/qgis_server_light/exporter/funcs.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
|
get_project_server_entries(project, scope_or_scopes)
Gets values from the fields displayed in QGIS under Project > Properties > Server.
Returns a Dictionary holding all pairs of
Source code in src/qgis_server_light/exporter/funcs.py
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 |
|
make_wgs84_geom_transform(project, layer)
Makes a QgisCoordinateTransform to transform a layer to EPSG:4326).
Source code in src/qgis_server_light/exporter/funcs.py
38 39 40 41 42 |
|