qgis_server_light
qgis_server_light
crs
This module contains the crs handling shared by the exporter and the worker. It is the only place where QGIS crs information is translated into the QGIS-Server-Light interface.
create_qsl_crs(crs: QgsCoordinateReferenceSystem) -> Crs
Translates a QGIS crs into an instance of the QGIS-Server-Light interface Crs.
Parameters:
-
crs(QgsCoordinateReferenceSystem) –The QGIS crs to take the information from.
Returns:
-
Crs–The instance of the QSL interface Crs.
Source code in src/qgis_server_light/crs.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |
debug
profile
profile_async(func)
A profiler which can be used as a decorator on ASYNC methods to produce profiles and call graphs.
The Callgraph might be inspected with QCacheGrind or KCacheGrind or sth. else.
Parameters:
-
func–the wrapped method
Returns:
-
–
The wrapper
Source code in src/qgis_server_light/debug/profile.py
5 6 7 8 9 10 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 | |
profile_sync(func)
A profiler which can be used as a decorator on SYNC methods to produce profiles and call graphs.
The Callgraph might be inspected with QCacheGrind or KCacheGrind or sth. else.
Parameters:
-
func–the wrapped method
Returns:
-
–
The wrapper
Source code in src/qgis_server_light/debug/profile.py
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 | |
dispatcher
redis_asio
This contains the dispatcher which passes a job info around a redis queue.
RedisDispatcher
Bases: RedisProtocol
The common part of the dispatchers: the connection to redis and how a job is put into it. How the result comes back is up to the subclasses, they are combined with the matching protocol.
Attributes:
-
job_info_classes(dict[type[QslJobParameter], type[QslJobInfoParameter]]) –The job info class per job parameter class, used to wrap a job parameter into its job info.
Source code in src/qgis_server_light/dispatcher/redis_asio.py
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 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 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 | |
client = redis_client
instance-attribute
job_info_classes: dict[type[QslJobParameter], type[QslJobInfoParameter]] = {QslJobParameterRender: QslJobInfoRender, QslJobParameterFeatureInfo: QslJobInfoFeatureInfo, QslJobParameterLegend: QslJobInfoLegend, QslJobParameterFeature: QslJobInfoFeature, QslJobParameterCrs: QslJobInfoCrs, QslJobParameterExecuteProcess: QslJobInfoExecuteProcess}
class-attribute
__init__(redis_client: redis_aio.Redis) -> None
Source code in src/qgis_server_light/dispatcher/redis_asio.py
83 84 85 86 87 88 | |
alive_workers() -> list[Worker]
async
Collects the workers which sent a heartbeat within worker_alive_age and did
not crash. Workers which are still registered but stopped beating (e.g. killed)
or reported a crash are left out, so the result tells who is really there to
process jobs.
Returns:
-
list[Worker]–The alive workers, sorted by their id to give a stable order.
Source code in src/qgis_server_light/dispatcher/redis_asio.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | |
create(url: str)
classmethod
Source code in src/qgis_server_light/dispatcher/redis_asio.py
90 91 92 93 | |
derive_job_info(job_id: str, job_parameter: QslJobParameter) -> QslJobInfoParameter
classmethod
Wraps the job parameter into the job info matching its type.
Parameters:
-
job_id(str) –The unique identifier of the job.
-
job_parameter(QslJobParameter) –The parameter for the job which should be executed.
Returns:
-
QslJobInfoParameter–The job info carrying the job parameter.
Raises:
-
TypeError–If there is no job info for the type of the job parameter.
Source code in src/qgis_server_light/dispatcher/redis_asio.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |
is_reachable() -> bool
async
Pings redis. The caller only needs to know whether jobs could be queued, so the redis exceptions stay in here and are logged.
Returns:
-
bool–True if redis answered, False if it could not be reached.
Source code in src/qgis_server_light/dispatcher/redis_asio.py
95 96 97 98 99 100 101 102 103 104 105 106 | |
parse_last_seen(last_seen: bytes) -> datetime.datetime
staticmethod
Reads the heartbeat timestamp of a worker as it is stored in redis.
Parameters:
-
last_seen(bytes) –The ISO timestamp as redis returns it.
Returns:
-
datetime–The timezone aware timestamp, naive ones are taken as UTC.
Source code in src/qgis_server_light/dispatcher/redis_asio.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
queue_job(job_info: QslJobInfoParameter, pipeline: Pipeline, start_time: float) -> None
async
Puts the job info into the job hash, sets the queued status and pushes the job id onto the queue of the protocol. Nothing is executed here, the caller adds what belongs to its protocol to the same transaction and executes it.
Parameters:
-
job_info(QslJobInfoParameter) –The job info of the job which should be queued.
-
pipeline(Pipeline) –The pipeline holding the transaction.
-
start_time(float) –The time the job was posted, used for the duration.
Source code in src/qgis_server_light/dispatcher/redis_asio.py
222 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 | |
registered_workers() -> list[Worker]
async
Collects every worker redis still knows, no matter how old its last heartbeat
is. This way crashed or silently vanished workers can be shown until their info
expires, the consumer tells them apart by info.status and last_seen.
Returns:
-
list[Worker]–The registered workers, sorted by their id to give a stable order.
Source code in src/qgis_server_light/dispatcher/redis_asio.py
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 | |
set_job_runtime_status(job_id, pipeline: Pipeline, status: str, start_time: float, execute: bool = True)
async
Sets the status of the job together with its timestamps and duration.
Parameters:
-
job_id–The unique identifier of the job.
-
pipeline(Pipeline) –The pipeline holding the transaction.
-
status(str) –The status to set.
-
start_time(float) –The time the job was posted, used for the duration.
-
execute(bool, default:True) –False if the caller adds more to the transaction and executes it itself.
Source code in src/qgis_server_light/dispatcher/redis_asio.py
191 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 | |
RedisQueue
Bases: RedisDispatcher, RedisPublishProtocol
The dispatcher for short living jobs a caller waits for. The result is received over the channel and nothing is kept in redis afterwards.
Source code in src/qgis_server_light/dispatcher/redis_asio.py
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 510 511 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 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 | |
post(job_parameter: QslJobParameterRender | QslJobParameterFeatureInfo | QslJobParameterLegend | QslJobParameterFeature | QslJobParameterCrs, to: float = 10.0) -> tuple[JobResult, str]
async
Posts a new runner to the runner queue and waits maximum timeout seconds to complete.
Will return a JobResult if successful or raise an error.
Parameters:
-
job_parameter(QslJobParameterRender | QslJobParameterFeatureInfo | QslJobParameterLegend | QslJobParameterFeature | QslJobParameterCrs) –The parameter for the job which should be executed.
-
to(float, default:10.0) –The timeout a job is expected to be waited for before canceling job execution.
Source code in src/qgis_server_light/dispatcher/redis_asio.py
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 510 511 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 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 | |
RedisStateQueue
Bases: RedisDispatcher, RedisStateProtocol
The dispatcher for jobs which keep their state. A job is submitted and
its state can be read at any time later, until the job hash expires. A
caller who wants to wait for the result uses wait.
Source code in src/qgis_server_light/dispatcher/redis_asio.py
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 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 | |
decode_optional(value: bytes | None) -> str | None
staticmethod
Decodes a hash field which might not be set.
Source code in src/qgis_server_light/dispatcher/redis_asio.py
403 404 405 406 | |
decode_progress(value: bytes | None) -> int | None
staticmethod
Decodes the progress, which is only set if the job reported one.
Source code in src/qgis_server_light/dispatcher/redis_asio.py
408 409 410 411 | |
dismiss(job_id: str) -> JobState | None
async
Dismisses a job. A queued job is taken off the queue and is dismissed right away. A job a worker took already gets the cancel flag, the worker cancels it and finishes it as dismissed, so its state changes a moment later. A finished job stays as it is, there is nothing left to stop.
Parameters:
-
job_id(str) –The unique identifier of the job.
Returns:
-
JobState | None–The state of the job after dismissing,
Noneif the job does not exist -
JobState | None–(anymore).
Source code in src/qgis_server_light/dispatcher/redis_asio.py
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 | |
job_result(job_id: str, job_hash: dict[str, bytes]) -> JobResult | None
Assembles the result of the job from its decoded job hash. The data stays bytes, the content type tells the caller how to read it.
Parameters:
-
job_id(str) –The unique identifier of the job.
-
job_hash(dict[str, bytes]) –The job hash with decoded field names.
Returns:
-
JobResult | None–The result,
Noneas long as the job has not succeeded.
Source code in src/qgis_server_light/dispatcher/redis_asio.py
413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | |
merge_process_descriptions(served: list[tuple[QgisInfo, ProcessDescriptions]]) -> ProcessDescriptions
staticmethod
Merges the processes of several workers into one list. Workers on one redis should all run the same QGIS and serve the same processes. When they don't, the description of the newest QGIS is taken and the process gets a warning, so the deployment can be corrected.
Parameters:
-
served(list[tuple[QgisInfo, ProcessDescriptions]]) –The QGIS of each worker and the processes it serves.
Returns:
-
ProcessDescriptions–Each process once, with a warning for each process the workers don't agree on.
Source code in src/qgis_server_light/dispatcher/redis_asio.py
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 | |
process_descriptions() -> ProcessDescriptions
async
The descriptions of the processes the alive process-workers serve, each worker keeps its own in its hash. Empty as long as no process-worker is alive.
Returns:
-
ProcessDescriptions–The processes merged over all workers, see
merge_process_descriptions.
Source code in src/qgis_server_light/dispatcher/redis_asio.py
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | |
state(job_id: str) -> JobState | None
async
Reads the current state of the job from its job hash.
Parameters:
-
job_id(str) –The unique identifier of the job.
Returns:
-
JobState | None–The state of the job,
Noneif the job does not exist (anymore).
Source code in src/qgis_server_light/dispatcher/redis_asio.py
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | |
submit(job_id: str, job_parameter: QslJobParameterExecuteProcess, execution_mode: ExecutionMode = ExecutionMode.ASYNC) -> None
async
Queues a process job and returns right away. The expiry is set in the same transaction, so a job which is never picked up does not stay in redis forever.
Parameters:
-
job_id(str) –The unique identifier of the job, given by the caller so it can refer to the job later.
-
job_parameter(QslJobParameterExecuteProcess) –The parameter for the process which should be executed.
-
execution_mode(ExecutionMode, default:ASYNC) –ExecutionMode.SYNCif the caller is going towaitfor the job, the worker only notifies then.
Source code in src/qgis_server_light/dispatcher/redis_asio.py
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | |
wait(job_id: str, to: float = 10.0) -> JobState | None
async
Waits maximum to seconds for the job to finish. This is what makes a
synchronous execution possible on top of a job which keeps its state.
It only gets notified if the job was submitted with
ExecutionMode.SYNC, otherwise it runs into the timeout.
Parameters:
-
job_id(str) –The unique identifier of the job.
-
to(float, default:10.0) –The timeout in seconds.
Returns:
-
JobState | None–The state of the job after it finished or the timeout passed,
None -
JobState | None–if the job does not exist (anymore).
Source code in src/qgis_server_light/dispatcher/redis_asio.py
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | |
wait_for_notification(ps: PubSub, job_id: str, to: float) -> None
async
staticmethod
Blocks until a message arrives on the subscribed channel or the timeout passes. The message itself is not of interest, the state is read from the job hash afterwards.
Parameters:
-
ps(PubSub) –The pubsub which is subscribed to the channel of the job.
-
job_id(str) –The unique identifier of the job, used for logging.
-
to(float) –The timeout in seconds.
Source code in src/qgis_server_light/dispatcher/redis_asio.py
456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 | |
exporter
api
DATA_ROOT: Path | None = Path(env_data_root) if env_data_root is not None else None
module-attribute
LOGLEVEL: str = 'INFO'
module-attribute
app = Flask(__name__)
module-attribute
env_data_root = os.environ.get('QSL_DATA_ROOT', None)
module-attribute
api_export()
Source code in src/qgis_server_light/exporter/api.py
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 | |
assemble_output_file_path(project_base_path: Path, output_format: str) -> Path
Source code in src/qgis_server_light/exporter/api.py
35 36 | |
assemble_project_base_path(data_path: Path, project_path: str) -> Path
Source code in src/qgis_server_light/exporter/api.py
31 32 | |
main() -> None
Just the central cli entry command. Currently, we don't use it, but its here for future content.
Source code in src/qgis_server_light/exporter/api.py
115 116 117 118 119 120 121 122 | |
start(data_root, host: str = '127.0.0.1', port: int = 5000, log_level: str = 'info')
Source code in src/qgis_server_light/exporter/api.py
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 | |
cli
allowed_extensions = ('qgz', 'qgs')
module-attribute
allowed_output_formats = ('json', 'xml')
module-attribute
qgs = QgsApplication([], False)
module-attribute
export(project: str, unify_layer_names_by_group: bool = False, output_format: str | None = None) -> None
Source code in src/qgis_server_light/exporter/cli.py
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 | |
main() -> None
Just the central cli entry command. Currently, we don't use it, but its here for future content.
Source code in src/qgis_server_light/exporter/cli.py
24 25 26 27 28 29 30 | |
exceptions
ExportFailure
Bases: Exception
Source code in src/qgis_server_light/exporter/exceptions.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | |
EXIT_CODE = 3
class-attribute
instance-attribute
exporter = exporter
instance-attribute
messages = messages
instance-attribute
project = project
instance-attribute
__init__(*, messages: list[ExportMessage], project: Project, exporter: Exporter) -> None
Source code in src/qgis_server_light/exporter/exceptions.py
12 13 14 15 16 17 18 19 20 21 22 | |
get_result() -> ResultWithMessages
Source code in src/qgis_server_light/exporter/exceptions.py
24 25 26 27 28 29 | |
extract
Exporter
Source code in src/qgis_server_light/exporter/extract.py
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 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 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 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 510 511 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 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 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 607 608 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 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 | |
name = self.prepare_qgis_project_name(self.qgis_project)
instance-attribute
path = qgis_project_path
instance-attribute
qgis_project = self.open_qgis_project(qgis_project_path)
instance-attribute
qgis_project_tree_root = self.qgis_project.layerTreeRoot()
instance-attribute
qsl_config = Config(exporter=(ExporterMeta(qgis_version=(Qgis.version()))), project=(self.qsl_project), meta_data=(self.qsl_project_metadata), tree=(self.qsl_tree), datasets=(self.qsl_datasets))
instance-attribute
qsl_datasets = Datasets()
instance-attribute
qsl_project = Project(name=(self.name), version=(self.version.text()))
instance-attribute
qsl_project_metadata = self.extract_metadata(self.qgis_project)
instance-attribute
qsl_tree = Tree()
instance-attribute
unify_layer_names_by_group = unify_layer_names_by_group
instance-attribute
unify_layer_names_by_group_separator = unify_layer_names_by_group_separator
instance-attribute
version = self.qgis_project.lastSaveVersion()
instance-attribute
__init__(qgis_project_path: str, unify_layer_names_by_group=False, unify_layer_names_by_group_separator='.')
Source code in src/qgis_server_light/exporter/extract.py
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 | |
build_export_failure()
Source code in src/qgis_server_light/exporter/extract.py
1279 1280 1281 1282 1283 1284 | |
create_qsl_bbox_from_qgis_rectangle_extent(extent: QgsRectangle) -> BBox
staticmethod
Source code in src/qgis_server_light/exporter/extract.py
1055 1056 1057 1058 1059 1060 1061 1062 | |
create_qsl_bbox_from_qgis_rectangle_wgs84(project: QgsProject, layer: QgsMapLayer, extent: QgsRectangle) -> BBox
Reprojects the job_layer_definition's extent using WGS84.
Parameters:
-
project(QgsProject) –The QGIS project instance for projection context.
-
layer(QgsMapLayer) –The job_layer_definition which for the projection context.
-
extent(QgsRectangle) –The extent which will be reprojected.
Returns:
-
BBox–The QSL bbox reprojected to WGS84.
Source code in src/qgis_server_light/exporter/extract.py
1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 | |
create_qsl_crs_from_qgs_layer(layer: QgsMapLayer) -> Crs
staticmethod
Translates the QGIS job_layer_definition crs information into an instance of the QGIS-Server-Light interface Crs instance.
Parameters:
-
layer(QgsMapLayer) –The job_layer_definition to take the crs information from.
Returns:
-
Crs–The instance of the QSL interface Crs.
Source code in src/qgis_server_light/exporter/extract.py
971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 | |
create_qsl_editor_widget(setup: QgsEditorWidgetSetup) -> EditorWidget | None
staticmethod
Translates the configuration of the editor widgets which define value lists or domains. Layer and relation references are exported as they are, resolving them is left to the consumer!
Parameters:
-
setup(QgsEditorWidgetSetup) –The editor widget setup of a field of an
QgsVectorLayer.
Returns:
-
EditorWidget | None–The editor widget configuration or None if the widget type is not exported.
Source code in src/qgis_server_light/exporter/extract.py
533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 | |
create_qsl_field_constraints(field: QgsField) -> FieldConstraints
staticmethod
Builder function to create the interface instance.
Source code in src/qgis_server_light/exporter/extract.py
613 614 615 616 617 618 619 620 621 622 | |
create_qsl_field_from_qgis_field(field: QgsField, is_primary_key: bool, is_generated: bool = False) -> Field
staticmethod
Source code in src/qgis_server_light/exporter/extract.py
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 | |
create_qsl_fields_from_qgis_field(layer: QgsVectorLayer) -> list[Field]
Source code in src/qgis_server_light/exporter/extract.py
686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 | |
create_qsl_range(config: dict) -> Range
staticmethod
Builder function to create the interface instance.
Source code in src/qgis_server_light/exporter/extract.py
597 598 599 600 601 602 603 604 | |
create_qsl_relations(project: QgsProject) -> list[Relation]
staticmethod
Translates the relations of the project. All relations are exported, also the ones whose layers are not part of the export.
Parameters:
-
project(QgsProject) –The instantiated QGIS project.
Returns:
-
list[Relation]–The relations of the project.
Source code in src/qgis_server_light/exporter/extract.py
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 653 654 | |
create_qsl_source_gdal(datasource: dict) -> GdalSource
staticmethod
Source code in src/qgis_server_light/exporter/extract.py
929 930 931 | |
create_qsl_source_ogr(datasource: dict) -> OgrSource
staticmethod
Source code in src/qgis_server_light/exporter/extract.py
933 934 935 | |
create_qsl_source_postgresql(datasource: dict) -> PostgresSource
staticmethod
Creates the QSL postgres source from the datasource as it is stored in the QGIS project. A referenced pg_service is NOT resolved: connection info and credentials stay in the pg_service.conf (PGSERVICEFILE) and are resolved by libpq at connection time on the consumer side.
Parameters:
-
datasource(dict) –The decoded and cleaned datasource of the layer. Its sslmode, if any, is the stringified QGIS int (e.g. "3" for require).
Returns:
-
PostgresSource–The QSL postgres source.
Source code in src/qgis_server_light/exporter/extract.py
937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 | |
create_qsl_source_vector_tiles(datasource: dict) -> VectorTileSource
staticmethod
Source code in src/qgis_server_light/exporter/extract.py
913 914 915 | |
create_qsl_source_wcs(datasource: dict) -> WcsSource
staticmethod
Source code in src/qgis_server_light/exporter/extract.py
925 926 927 | |
create_qsl_source_wms(datasource: dict) -> WmsSource
staticmethod
Source code in src/qgis_server_light/exporter/extract.py
909 910 911 | |
create_qsl_source_wmts(datasource: dict) -> WmtsSource
staticmethod
Source code in src/qgis_server_light/exporter/extract.py
921 922 923 | |
create_qsl_source_xyz(datasource: dict) -> XYZSource
staticmethod
Source code in src/qgis_server_light/exporter/extract.py
917 918 919 | |
create_qsl_value_map(config: dict) -> ValueMap
staticmethod
Reads the value map as QGIS knows them (2 kinds): the current one, a list of single
entry dicts, and the old one, a single dict. Both map description to key, the
key QgsValueMapFieldFormatter.NULL_VALUE stands for NULL.
Parameters:
-
config(dict) –The editor widget configuration of a
ValueMapwidget.
Returns:
-
ValueMap–The value map in the order defined in QGIS.
Source code in src/qgis_server_light/exporter/extract.py
560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 | |
create_qsl_value_relation(config: dict) -> ValueRelation
staticmethod
Builder function to create the interface instance.
Source code in src/qgis_server_light/exporter/extract.py
585 586 587 588 589 590 591 592 593 594 595 | |
create_style_list(qgs_layer: QgsMapLayer) -> list[Style]
staticmethod
Source code in src/qgis_server_light/exporter/extract.py
1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 | |
create_unified_short_name(short_name: str, path: list[str])
Creates the unified short name, separated by the configured separator.
Parameters:
-
short_name(str) –The short name either of the group or the job_layer_definition.
-
path(list[str]) –The path is a list of string which stores the information of the current tree path. This is used to construct a string for unifying job_layer_definition names by their tree path.
Returns:
Source code in src/qgis_server_light/exporter/extract.py
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 | |
extract_datasource_dict(layer: QgsMapLayer) -> dict
Decodes a QGIS map job_layer_definition datasource into a dict and ensures that types are pythonic and pathes are clean for further usage.
Parameters:
-
layer(QgsMapLayer) –The job_layer_definition which the datasource should be extracted from.
Returns:
-
dict–The decoded and cleaned datasource.
Source code in src/qgis_server_light/exporter/extract.py
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 | |
extract_group(group: QgsLayerTreeGroup, path: list[str])
Collects data pertaining to a QGIS job_layer_definition tree group. Basically this translates a QgsLayerTreeGroup into a QGIS-Server-Light TreeGroup.
Parameters:
-
group(QgsLayerTreeGroup) –The group which is handled.
-
path(list[str]) –The path is a list of string which stores the information of the current tree path. This is used to construct a string for unifying job_layer_definition names by their tree path.
Source code in src/qgis_server_light/exporter/extract.py
180 181 182 183 184 185 186 187 188 189 190 191 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 222 223 | |
extract_metadata(project: QgsProject) -> MetaData
staticmethod
Creates a QSL interface instance for metadate pulled out of the QGIS project.
Parameters:
-
project(QgsProject) –The instantiated QGIS project.
Returns:
-
MetaData–The metadata interface instance.
Source code in src/qgis_server_light/exporter/extract.py
1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 | |
extract_save_layer(child: QgsLayerTreeLayer, path: list[str], types_from_editor_widget: bool = False)
Save the given job_layer_definition to the output path.
Source code in src/qgis_server_light/exporter/extract.py
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 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 | |
get_group_short_name(group: QgsLayerTreeGroup) -> str
staticmethod
Source code in src/qgis_server_light/exporter/extract.py
778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 | |
get_group_title(group: QgsLayerTreeGroup) -> str
staticmethod
Source code in src/qgis_server_light/exporter/extract.py
764 765 766 767 768 769 770 771 772 773 774 775 776 | |
get_layer_extent(layer: QgsMapLayer) -> QgsReferencedRectangle | None
Layer extent in the layer CRS, else the project fallback reprojected into it.
Source code in src/qgis_server_light/exporter/extract.py
1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 | |
get_layer_short_name(layer: QgsLayerTreeLayer) -> str
staticmethod
This method determines which name is used as the short name of the job_layer_definition.
Parameters:
-
layer(QgsLayerTreeLayer) –The job_layer_definition which the short name should be derived from.
Returns:
-
str–The short name.
Source code in src/qgis_server_light/exporter/extract.py
991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 | |
get_layer_type(layer: QgsMapLayer) -> str | None
staticmethod
Gets the type of the given Qgis job_layer_definition as a string if the type is supported. This is to flatten the understanding of layers from qgis into something we can handle.
Parameters:
-
layer(QgsMapLayer) –The job_layer_definition to decide the type for.
Returns:
-
str | None–"raster", "vector" or "custom" if a job_layer_definition matched and None otherwise.
Source code in src/qgis_server_light/exporter/extract.py
1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 | |
get_project_extent(project: QgsProject) -> QgsReferencedRectangle | None
staticmethod
WMS advertised extent, else View Settings full extent, else project CRS area of use.
Source code in src/qgis_server_light/exporter/extract.py
1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 | |
get_project_server_entries(project, scope_or_scopes: str | list) -> dict
staticmethod
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/extract.py
1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 | |
is_layer_valid(layer: QgsMapLayer) -> bool
staticmethod
Source code in src/qgis_server_light/exporter/extract.py
1136 1137 1138 1139 1140 1141 1142 1143 1144 | |
is_wms_background_layer(layer: QgsMapLayer) -> bool
staticmethod
Source code in src/qgis_server_light/exporter/extract.py
760 761 762 | |
make_wgs84_geom_transform(project, layer) -> QgsCoordinateTransform
staticmethod
Creates a QgisCoordinateTransform context to transform a job_layer_definition to EPSG:4326 aka wgs84.
Parameters:
-
project–The QGIS project instance.
-
layer–The job_layer_definition which's extent should be reprojected.
Returns:
-
QgsCoordinateTransform–The QGIS transformation context.
Source code in src/qgis_server_light/exporter/extract.py
1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 | |
obtain_editor_widget_type_from_qgis_field(field: QgsField) -> tuple[str, str, str, str] | tuple[str, None, None, None]
staticmethod
We simply mimikri QGIS Server here
TODO: This could be improved alot! Maybe we can also backport that to QGIS core some day?
Parameters:
-
field(QgsField) –The field of an
QgsVectorLayer.
Returns:
-
tuple[str, str, str, str] | tuple[str, None, None, None]–Unified type name regarding
-
tuple[str, str, str, str] | tuple[str, None, None, None]–
Source code in src/qgis_server_light/exporter/extract.py
827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 | |
obtain_is_generated(provider, field_index: int) -> bool
staticmethod
Source code in src/qgis_server_light/exporter/extract.py
715 716 717 718 719 720 721 | |
obtain_nullable(field: QgsField) -> bool
staticmethod
Parameters:
-
field(QgsField) –The field of an
QgsVectorLayer.
Returns:
-
bool–False if the field carries a NotNull constraint (possibly combined with
-
bool–others like Unique or Expression), True otherwise.
Source code in src/qgis_server_light/exporter/extract.py
656 657 658 659 660 661 662 663 664 665 666 667 668 | |
obtain_simple_types_from_qgis_field_json(field: QgsField) -> tuple[str, str] | tuple[str, None]
staticmethod
Delivers the type match for json based on the field QgsField type.
Parameters:
-
field(QgsField) –The field of an
QgsVectorLayer.
Returns:
-
tuple[str, str] | tuple[str, None]–Unified type name and format in a tuple.
Source code in src/qgis_server_light/exporter/extract.py
871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 | |
obtain_simple_types_from_qgis_field_xml(field: QgsField) -> str
staticmethod
Parameters:
-
field(QgsField) –The field of an
QgsVectorLayer.
Returns:
-
str–Unified type name regarding
-
str– -
IMPORTANT(str) –If type is not matched within the function it will be
stringalways!
Source code in src/qgis_server_light/exporter/extract.py
723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 | |
open_qgis_project(path_to_project: str) -> QgsProject
staticmethod
Parameters:
-
path_to_project(str) –The absolute path on the file system where the project
Returns:
-
QgsProject–The opened project (read).
Source code in src/qgis_server_light/exporter/extract.py
1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 | |
prepare_qgis_project_name(project: QgsProject) -> str
staticmethod
Parameters:
-
project(QgsProject) –The instantiated QGIS project.
Returns:
-
str–Project name
Source code in src/qgis_server_light/exporter/extract.py
1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 | |
provide_field_length(field: QgsField) -> int | None
staticmethod
Source code in src/qgis_server_light/exporter/extract.py
670 671 672 673 674 675 676 | |
provide_field_precision(field: QgsField) -> int | None
staticmethod
Source code in src/qgis_server_light/exporter/extract.py
678 679 680 681 682 683 684 | |
provide_float(value) -> float | None
staticmethod
Just an internal helper
Source code in src/qgis_server_light/exporter/extract.py
606 607 608 609 610 611 | |
rewrite_datasource_with_qgis3_compatible_uri(layer: QgsMapLayer)
Source code in src/qgis_server_light/exporter/extract.py
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 | |
run() -> Config
Source code in src/qgis_server_light/exporter/extract.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |
sanitize_name(raw: str, lower: bool = False) -> str
staticmethod
Transforms an arbitrary string into a WMS/WFS and URL compatible short name for a job_layer_definition or group.
Steps: 1. Unicode‑NFD → ASCII‑transliteration (removes umlauts/diacritics). 2. All chars, which are NOT [A‑Za‑z0‑9_.‑], will be replaced by '' ersetzen. 3. Reduce multiple underscore '' to a single one. 4. Remove leading '', '.', '-'. 5. If the string is empty OR does not start with a letter OR not start with '', a leading '_' will be added. 6. Optional all will be converted to lowercase (lower=True).
Source code in src/qgis_server_light/exporter/extract.py
796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 | |
short_name(short_name: str, path: list[str]) -> str
Decides if to use the short name itself or the unified version by the tree path.
Parameters:
-
short_name(str) –The short name either of the group or the job_layer_definition.
-
path(list[str]) –The path is a list of string which stores the information of the current tree path. This is used to construct a string for unifying job_layer_definition names by their tree path.
Returns:
-
str–The short name itself or its unified tree path.
Source code in src/qgis_server_light/exporter/extract.py
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | |
sslmode_int_to_str(ssl_mode: int) -> str
staticmethod
Mapper to map ssl modes from QGIS int to plain postgres.
Parameters:
-
ssl_mode(int) –The ssl mode of the datasource as a int value matching one of https://qgis.org/pyqgis/3.44/core/QgsDataSourceUri.html#qgis.core.QgsDataSourceUri.SslMode
Returns:
-
str–The string representation of the ssl mode as it is used by postgres connections.
Source code in src/qgis_server_light/exporter/extract.py
957 958 959 960 961 962 963 964 965 966 967 968 969 | |
walk_qgis_project_tree(entity: QgsLayerTreeNode, path: list[str])
This is a highly recursive function which walks to the qgis job_layer_definition tree to extract all knowledge out of it. It is called from itself again for each level of group like elements which are found.
Parameters:
-
entity(QgsLayerTreeNode) –The QGIS projects tree node which can be a QgsLayerTree, QgsLayerTreeGroup or QgsLayerTreeLayer.
-
path(list[str]) –The path is a list of string which stores the information of the current tree path. This is used to construct a string for unifying job_layer_definition names by their tree path.
Source code in src/qgis_server_light/exporter/extract.py
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 | |
interface
common
This module contains common logic, shared beyond all specialised parts of the QGIS-Server-Light interface.
BBox
dataclass
Bases: BaseInterface
Source code in src/qgis_server_light/interface/common.py
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 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | |
x_max: float = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
x_min: float = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
y_max: float = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
y_min: float = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
z_max: float = field(default=0.0, metadata={'type': 'Element'})
class-attribute
instance-attribute
z_min: float = field(default=0.0, metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(x_min: float, x_max: float, y_min: float, y_max: float, z_min: float = 0.0, z_max: float = 0.0) -> None
from_list(bbox_list: list[float]) -> BBox
staticmethod
Takes a list representation of a BBox in the form
[
Source code in src/qgis_server_light/interface/common.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | |
from_string(bbox_string: str) -> BBox
staticmethod
Takes a CSV string representation of a BBox in the form
'
Source code in src/qgis_server_light/interface/common.py
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 | |
to_2d_list() -> list
Source code in src/qgis_server_light/interface/common.py
158 159 | |
to_2d_string() -> str
Source code in src/qgis_server_light/interface/common.py
161 162 | |
to_list() -> list
Source code in src/qgis_server_light/interface/common.py
152 153 | |
to_string() -> str
Source code in src/qgis_server_light/interface/common.py
155 156 | |
BaseInterface
dataclass
This class should be used as base class for all dataclasses in the interface. It offers useful methods to handle exposed content in a centralized way. Mainly for logging redaction.
Since dataclasses gets a repr method installed automatically when they are created, a dataclass inheriting from this base class has to be defined as follows:
@dataclass(repr=False)
class Config(BaseInterface):
id: int = field(metadata={"type": "Element"})
secure: str = field(metadata={"type": "Element"})
long_content: str = field(metadata={"type": "Element"})
@property
def shortened_fields(self) -> set:
return {"long_content"}
@property
def redacted_fields(self) -> set:
return {"secure"}
This way, when an instance of this example class gets logged somewhere it the output will be redacted, meaning the logging output might look like this:
Config(id=1, secure=**REDACTED**, long_content=abc12...io345)
Source code in src/qgis_server_light/interface/common.py
7 8 9 10 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 | |
redacted_fields: set
property
Field which contents should get redacted before printing them on the log. This is mainly used to prevent passwords in logs.
Returns:
-
set–The set of field names which should be redacted
shorten_limit: int
property
The limit to which the content of a field should be shortened.
Returns:
-
int–The limit.
shortened_fields: set
property
Fields which should be shortened to a length, this is manly useful for large content fields with BLOB etc.
Returns:
-
set–The set field names which should be shortened.
__init__() -> None
__repr__()
Source code in src/qgis_server_light/interface/common.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
Crs
dataclass
Bases: BaseInterface
Source code in src/qgis_server_light/interface/common.py
218 219 220 221 222 223 224 225 226 227 228 229 | |
auth_id: str = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
axis_inverted: bool = field(default=False, metadata={'type': 'Element'})
class-attribute
instance-attribute
ogc_uri: str = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
ogc_urn: str = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
postgis_srid: int = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(auth_id: str = None, postgis_srid: int = None, ogc_uri: str = None, ogc_urn: str = None, axis_inverted: bool = False) -> None
RedactedString
This special string class can be used to handle secret strings in the application. It works like a normal string but in case it's used to print or log its value is not reveled to the output.
Source code in src/qgis_server_light/interface/common.py
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 | |
__format__(format_spec)
Source code in src/qgis_server_light/interface/common.py
126 127 | |
__init__(value, redacted_text='**REDACTED**')
Source code in src/qgis_server_light/interface/common.py
116 117 118 | |
__json__()
Source code in src/qgis_server_light/interface/common.py
129 130 | |
__repr__()
Source code in src/qgis_server_light/interface/common.py
123 124 | |
__str__()
Source code in src/qgis_server_light/interface/common.py
120 121 | |
reveal()
Allows access to the original value when necessary.
Returns:
-
–
The secret string.
Source code in src/qgis_server_light/interface/common.py
132 133 134 135 136 137 138 139 140 | |
Style
dataclass
Bases: BaseInterface
Source code in src/qgis_server_light/interface/common.py
232 233 234 235 236 237 238 239 | |
definition: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
name: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
shortened_fields: set
property
__init__(name: str, definition: str) -> None
dispatcher
common
JobState
dataclass
The state of a job which keeps its state (see RedisStateProtocol) as
it was read from the job hash. It gives the dispatcher one thing to hand
over instead of the raw redis fields.
Attributes:
-
id(str) –The unique identifier of the job.
-
status(Status) –The current status of the job.
-
last_update(str | None) –ISO timestamp of the last status change.
-
result(JobResult | None) –The result of a succeeded job.
-
message(str | None) –The error message of a failed job, or why a dismissed one stopped.
-
progress(int | None) –The percentage (0-100) the job reported last,
Noneif it reported none (yet).
Source code in src/qgis_server_light/interface/dispatcher/common.py
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 | |
finished: bool
property
If the job reached a final status, nothing changes on it anymore.
id: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
last_update: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
message: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
progress: int | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
result: JobResult | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
status: Status = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(id: str, status: Status, last_update: str | None = None, result: JobResult | None = None, message: str | None = None, progress: int | None = None) -> None
Status
Bases: Enum
Source code in src/qgis_server_light/interface/dispatcher/common.py
9 10 11 12 13 14 | |
DISMISSED = 'dismissed'
class-attribute
instance-attribute
FAILURE = 'failed'
class-attribute
instance-attribute
QUEUED = 'queued'
class-attribute
instance-attribute
RUNNING = 'running'
class-attribute
instance-attribute
SUCCESS = 'succeed'
class-attribute
instance-attribute
Worker
dataclass
A worker the dispatcher has seen alive on the queue. It carries what a consumer needs to tell whether jobs can be served and what the worker is doing right now.
Attributes:
-
id(str) –The unique identifier of the worker.
-
last_seen(datetime) –The time of the last heartbeat of the worker, always timezone aware.
-
info(EngineInfo) –The info the worker published with its last heartbeat (status, QGIS version, start time).
Source code in src/qgis_server_light/interface/dispatcher/common.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | |
id: str
instance-attribute
info: EngineInfo
instance-attribute
last_seen: datetime
instance-attribute
__init__(id: str, last_seen: datetime, info: EngineInfo) -> None
protocol
This contains the protocol definition about how a job is passed around a redis queue. It is shared by the dispatcher and the worker and therefore must not depend on anything else than the standard library.
RedisProtocol
Names of the redis queue, the job hash fields and the notification
channel a job is exchanged with. It is the common ground of both ways a
job result is delivered, the concrete queue is defined by the subclasses
RedisPublishProtocol and RedisStateProtocol.
A job is put into redis as hash under job:{id} (see job_key) and its
id is pushed onto the list returned by queue_name. A worker listens on
the queue of the protocol it is built on. The hash holds the fields:
info: The job info serialized as JSON.info_type: The class name of the job info, used to parseinfo.status: The currentStatusvalue of the job.timestamp.{status}: ISO timestamp when the job entered that status.timestamp.last_update: ISO timestamp of the last status change.duration: Seconds since the job was posted, as string.
The channel notifications:{id} (see channel) is used to tell a waiting
dispatcher that the job is finished. What is sent over it depends on the
subclass.
A worker registers itself as hash under worker:{id} (see worker_key) and
adds its id to the set worker_list_name. The hash holds the fields:
info: The engine info serialized as JSON.last_seen: ISO timestamp (UTC) of the last heartbeat.processes: The descriptions of the processes a process-worker serves (ProcessDescriptions) as JSON, only written by process-workers.
Attributes:
-
job_queue_name(str) –The name of the redis list the ids of the jobs are queued on. Set by the subclasses.
-
job_info_key(str) –The hash field holding the serialized job info.
-
job_info_type_key(str) –The hash field holding the class name of the job info.
-
job_channel_name(str) –The prefix of the channel a finished job is notified on.
-
job_status_key(str) –The hash field holding the job status.
-
job_duration_key(str) –The hash field holding the job duration.
-
job_timestamp_key(str) –The prefix of the hash fields holding the timestamps.
-
job_last_update_key(str) –The hash field holding the timestamp of the last update.
-
worker_list_name(str) –The name of the redis set the worker ids are registered in.
-
worker_info_key(str) –The hash field holding the serialized engine info.
-
worker_last_seen_key(str) –The hash field holding the timestamp of the last heartbeat.
-
worker_heartbeat_interval(int) –Seconds between two heartbeats of a worker.
-
worker_alive_age(int) –Seconds a heartbeat may be old for the worker to count as alive.
-
worker_processes_key(str) –The hash field holding the descriptions of the processes the worker serves.
Source code in src/qgis_server_light/interface/dispatcher/protocol.py
8 9 10 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 | |
job_channel_name: str = 'notifications'
class-attribute
instance-attribute
job_duration_key: str = 'duration'
class-attribute
instance-attribute
job_info_key: str = 'info'
class-attribute
instance-attribute
job_info_type_key: str = 'info_type'
class-attribute
instance-attribute
job_last_update_key: str = f'{job_timestamp_key}.last_update'
class-attribute
instance-attribute
job_queue_name: str
instance-attribute
job_status_key: str = 'status'
class-attribute
instance-attribute
job_timestamp_key: str = 'timestamp'
class-attribute
instance-attribute
worker_alive_age: int = 10 * worker_heartbeat_interval
class-attribute
instance-attribute
worker_heartbeat_interval: int = 1
class-attribute
instance-attribute
worker_info_key: str = 'info'
class-attribute
instance-attribute
worker_last_seen_key: str = 'last_seen'
class-attribute
instance-attribute
worker_list_name: str = 'workers'
class-attribute
instance-attribute
worker_processes_key: str = 'processes'
class-attribute
instance-attribute
channel(job_id: str) -> str
classmethod
The channel a finished job is notified on.
Parameters:
-
job_id(str) –The unique identifier of the job.
Source code in src/qgis_server_light/interface/dispatcher/protocol.py
87 88 89 90 91 92 93 94 | |
job_key(job_id: str) -> str
staticmethod
The key of the redis hash holding the job.
Parameters:
-
job_id(str) –The unique identifier of the job.
Source code in src/qgis_server_light/interface/dispatcher/protocol.py
71 72 73 74 75 76 77 78 | |
queue_name() -> str
classmethod
The name of the queue the jobs of this protocol are queued on. It is a method on purpose, so the place where the name is decided stays the same if it ever needs to be assembled.
Source code in src/qgis_server_light/interface/dispatcher/protocol.py
80 81 82 83 84 85 | |
worker_key(worker_id: str) -> str
staticmethod
The key of the redis hash holding the worker registration.
Parameters:
-
worker_id(str) –The unique identifier of the worker.
Source code in src/qgis_server_light/interface/dispatcher/protocol.py
96 97 98 99 100 101 102 103 | |
RedisPublishProtocol
Bases: RedisProtocol
The protocol of short living jobs a dispatcher waits for, like
rendering a map or a legend. The worker publishes the pickled JobResult
over the channel and the dispatcher deletes the job hash after it has
received it. Nothing is kept, a result is only there for the one who is
listening.
Attributes:
-
job_queue_name(str) –The name of the redis list the ids of the jobs are queued on.
Source code in src/qgis_server_light/interface/dispatcher/protocol.py
106 107 108 109 110 111 112 113 114 115 116 117 118 | |
job_queue_name: str = 'jobs'
class-attribute
instance-attribute
RedisStateProtocol
Bases: RedisProtocol
The protocol of jobs which keep their state, these are the processes.
The worker writes the result (or the error message) into the job hash in
the same transaction as the final status, so whoever reads the hash never
sees a finished job without its result. The hash expires after
job_expire seconds, it is the only place the result lives.
Only the status value is sent over the channel and only if the job was
submitted with ExecutionMode.SYNC. It just wakes the waiting dispatcher,
which then reads the job hash. Asynchronous jobs are polled, nobody waits
for a notification there.
Processes are queued on their own list, so long-running processes never block map related jobs.
Additional hash fields:
result: The data of theJobResultof a succeeded job.result_content_type: The content type ofresult.message: The error message of a failed job.progress: The percentage (0-100) the running job reported, only if it reports any. It is written while the job runs, outside the transaction.cancel: Set by the dispatcher to dismiss a job the worker took already. The worker cancels the job and finishes it asdismissed.
Attributes:
-
job_queue_name(str) –The name of the redis list the ids of the jobs are queued on.
-
job_result_key(str) –The hash field holding the result data.
-
job_result_content_type_key(str) –The hash field holding the content type of the result data.
-
job_message_key(str) –The hash field holding the error message.
-
job_progress_key(str) –The hash field holding the progress in percent.
-
job_cancel_key(str) –The hash field asking the worker to cancel the job.
-
job_expire(int) –Seconds the job hash is kept after it was submitted and again after it is finished.
Source code in src/qgis_server_light/interface/dispatcher/protocol.py
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 | |
job_cancel_key: str = 'cancel'
class-attribute
instance-attribute
job_expire: int = 86400
class-attribute
instance-attribute
job_message_key: str = 'message'
class-attribute
instance-attribute
job_progress_key: str = 'progress'
class-attribute
instance-attribute
job_queue_name: str = 'jobs:process'
class-attribute
instance-attribute
job_result_content_type_key: str = 'result_content_type'
class-attribute
instance-attribute
job_result_key: str = 'result'
class-attribute
instance-attribute
exporter
api
ExportParameters
dataclass
Bases: BaseInterface
The serializable request parameters which are accepted by the exporter service.
Source code in src/qgis_server_light/interface/exporter/api.py
6 7 8 9 10 11 12 13 14 | |
output_format: str = field(metadata={'type': 'Element'}, default='json')
class-attribute
instance-attribute
project_path: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
unify_layer_names_by_group: bool = field(metadata={'type': 'Element'}, default=False)
class-attribute
instance-attribute
__init__(project_path: str, unify_layer_names_by_group: bool = False, output_format: str = 'json') -> None
ExportResult
dataclass
Bases: BaseInterface
The serializable response which is provided by the exporter service.
Source code in src/qgis_server_light/interface/exporter/api.py
17 18 19 20 21 22 23 24 | |
content: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
successful: bool = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(successful: bool, content: str) -> None
extract
This module contains all interface definition to translate from QGIS project to QGIS-Server-Light logic and to write the JSON export of the QGIS project
AbstractDataset
dataclass
Bases: LayerLike
Source code in src/qgis_server_light/interface/exporter/extract.py
222 223 224 | |
title: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(id: str, name: str, is_checked: bool, title: str) -> None
Config
dataclass
Bases: ResultWithMessages
Source code in src/qgis_server_light/interface/exporter/extract.py
951 952 953 954 955 956 957 958 959 | |
datasets: Datasets = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
meta_data: MetaData = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
relations: list[Relation] = field(default_factory=list, metadata={'type': 'Element'})
class-attribute
instance-attribute
tree: Tree = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(project: Project, exporter: Exporter, meta_data: MetaData, tree: Tree, datasets: Datasets, relations: list[Relation] = list(), *, messages: list[ExportMessage] = list()) -> None
Custom
dataclass
Bases: DataSet
Source code in src/qgis_server_light/interface/exporter/extract.py
707 708 709 | |
__init__(id: str, name: str, is_checked: bool, title: str, source: DataSource, driver: str, bbox: BBox | None = None, bbox_wgs84: BBox | None = None, crs: Crs | None = None, styles: list[Style] = list(), minimum_scale: float | None = None, maximum_scale: float | None = None, style_name: str = 'default', is_spatial: bool = True, is_background: bool = False) -> None
DataSet
dataclass
Bases: AbstractDataset
Source code in src/qgis_server_light/interface/exporter/extract.py
646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 | |
bbox: BBox | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
bbox_wgs84: BBox | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
crs: Crs | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
driver: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
is_background: bool = field(default=False, metadata={'type': 'Element'})
class-attribute
instance-attribute
is_spatial: bool = field(default=True, metadata={'type': 'Element'})
class-attribute
instance-attribute
maximum_scale: float | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
minimum_scale: float | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
source: DataSource = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
style_name: str = field(default='default', metadata={'type': 'Element'})
class-attribute
instance-attribute
styles: list[Style] = field(default_factory=list, metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(id: str, name: str, is_checked: bool, title: str, source: DataSource, driver: str, bbox: BBox | None = None, bbox_wgs84: BBox | None = None, crs: Crs | None = None, styles: list[Style] = list(), minimum_scale: float | None = None, maximum_scale: float | None = None, style_name: str = 'default', is_spatial: bool = True, is_background: bool = False) -> None
get_style_by_name(name: str) -> Style | None
Source code in src/qgis_server_light/interface/exporter/extract.py
660 661 662 663 664 | |
style() -> Style | None
Source code in src/qgis_server_light/interface/exporter/extract.py
666 667 | |
DataSource
dataclass
Bases: BaseInterface
Source code in src/qgis_server_light/interface/exporter/extract.py
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 | |
definition: PostgresSource | WmtsSource | WmsSource | OgrSource | GdalSource | WfsSource | VectorTileSource | XYZSource | WcsSource | None
property
gdal: GdalSource | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
ogr: OgrSource | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
postgres: PostgresSource | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
vector_tile: VectorTileSource | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
wcs: WcsSource | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
wfs: WfsSource | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
wms: WmsSource | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
wmts: WmtsSource | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
xyz: XYZSource | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(postgres: PostgresSource | None = None, wmts: WmtsSource | None = None, wms: WmsSource | None = None, ogr: OgrSource | None = None, gdal: GdalSource | None = None, wfs: WfsSource | None = None, vector_tile: VectorTileSource | None = None, xyz: XYZSource | None = None, wcs: WcsSource | None = None) -> None
Datasets
dataclass
Bases: BaseInterface
Source code in src/qgis_server_light/interface/exporter/extract.py
812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 | |
custom: list[Custom] = field(default_factory=list, metadata={'type': 'Element'})
class-attribute
instance-attribute
group: list[Group] = field(default_factory=list, metadata={'type': 'Element'})
class-attribute
instance-attribute
raster: list[Raster] = field(default_factory=list, metadata={'type': 'Element'})
class-attribute
instance-attribute
vector: list[Vector] = field(default_factory=list, metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(vector: list[Vector] = list(), raster: list[Raster] = list(), custom: list[Custom] = list(), group: list[Group] = list()) -> None
find_dataset_by_id(id: str) -> Vector | Raster | Custom | None
Finds a dataset by id in the list of passed datasets.
Parameters:
-
id(str) –The id value which should be looked up
Returns:
Source code in src/qgis_server_light/interface/exporter/extract.py
831 832 833 834 835 836 837 838 839 840 841 842 843 844 | |
find_group_by_id(identifier: str) -> Group | None
Source code in src/qgis_server_light/interface/exporter/extract.py
846 847 848 849 850 | |
EditorWidget
dataclass
Bases: BaseInterface
Holds the configuration of the editor widget of a field. Only one of the
attributes is set, matching Field.editor_widget_type.
Source code in src/qgis_server_light/interface/exporter/extract.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | |
definition: ValueMap | ValueRelation | RelationReference | Range | None
property
range: Range | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
relation_reference: RelationReference | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
value_map: ValueMap | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
value_relation: ValueRelation | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(value_map: ValueMap | None = None, value_relation: ValueRelation | None = None, relation_reference: RelationReference | None = None, range: Range | None = None) -> None
ExportMessage
dataclass
Bases: BaseInterface
A warning or error produced while exporting the QGIS project.
Source code in src/qgis_server_light/interface/exporter/extract.py
898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 | |
code: Code = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
layer_id: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
level: Level = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
message: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
Code
Bases: StrEnum
Source code in src/qgis_server_light/interface/exporter/extract.py
906 907 908 909 910 911 912 913 914 915 916 917 918 | |
FIELD_EDITOR_WIDGET_TYPE_UNSUPPORTED = 'field_editor_widget_type_unsupported'
class-attribute
instance-attribute
LAYER_EMPTY = 'layer_empty'
class-attribute
instance-attribute
LAYER_EXTENT_FROM_PROJECT = 'layer_extent_from_project'
class-attribute
instance-attribute
LAYER_EXTENT_MISSING = 'layer_extent_missing'
class-attribute
instance-attribute
LAYER_EXTENT_REPROJECTION_FAILED = 'layer_extent_reprojection_failed'
class-attribute
instance-attribute
LAYER_INVALID = 'layer_invalid'
class-attribute
instance-attribute
LAYER_PROVIDER_UNSUPPORTED = 'layer_provider_unsupported'
class-attribute
instance-attribute
LAYER_TYPE_UNSUPPORTED = 'layer_type_unsupported'
class-attribute
instance-attribute
PROJECT_READ_FAILED = 'project_read_failed'
class-attribute
instance-attribute
PROJECT_VERSION_UNSUPPORTED = 'project_version_unsupported'
class-attribute
instance-attribute
TREE_NODE_UNSUPPORTED = 'tree_node_unsupported'
class-attribute
instance-attribute
UNEXPECTED_ERROR = 'unexpected_error'
class-attribute
instance-attribute
Level
Bases: StrEnum
Source code in src/qgis_server_light/interface/exporter/extract.py
902 903 904 | |
ERROR = 'error'
class-attribute
instance-attribute
WARNING = 'warning'
class-attribute
instance-attribute
__init__(level: Level, message: str, code: Code, layer_id: str | None = None) -> None
Exporter
dataclass
Bases: BaseInterface
Source code in src/qgis_server_light/interface/exporter/extract.py
893 894 895 | |
qgis_version: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(qgis_version: str) -> None
Field
dataclass
Bases: BaseInterface
Transportable (serializable) form of a QGIS vector job_layer_definition fiel (attribute). It contains the information of the original data datatype and its translated versions and the editor widget one as well.
Attributes:
-
name(str) –Machine readable name of the field
-
type(str) –Original type as defined by data source (PostGIS, GPKG, etc.)
-
is_primary_key(bool) –if the field is considered to be primary key.
-
is_generated(bool) –if the value of the primary key is generated by the source on insert.
-
type_wfs(str | None) –Translated type for further usage. Based on the simple types of XSD spec.
-
type_oapif(str | None) –Translated type based on the types of the OpenAPI Spec
-
type_oapif_format(str | None) –Format of the above-mentioned type based on the OpenAPI Spec
-
alias(str | None) –Human readable name.
-
comment(str | None) –Field description.
-
nullable(bool) –If this field can be NULL or not.
-
length(int | None) –The limitation in length on the field value.
-
precision(int | None) –The precision of the field value (float types)
-
editor_widget_type(str | None) –The original type how it is defined in the QGIS form.
-
editor_widget_type_wfs(str | None) –The translated type based on the simple types of XSD spec.
-
editor_widget_type_oapif(str | None) –Translated type based on the types of the OpenAPI Spec
-
editor_widget_type_oapif_format(str | None) –Format of the above-mentioned type based on the OpenAPI Spec
-
editor_widget(EditorWidget | None) –The configuration of the editor widget. None if the widget type is not one of the exported ones.
-
constraints(FieldConstraints | None) –The constraints of the field. None for exports which did not contain constraints yet.
Source code in src/qgis_server_light/interface/exporter/extract.py
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 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | |
alias: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
comment: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
constraints: FieldConstraints | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
editor_widget: EditorWidget | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
editor_widget_type: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
editor_widget_type_oapif: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
editor_widget_type_oapif_format: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
editor_widget_type_wfs: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
is_generated: bool = field(default=False, metadata={'type': 'Element'})
class-attribute
instance-attribute
is_primary_key: bool = field(default=False, metadata={'type': 'Element'})
class-attribute
instance-attribute
length: int | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
name: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
nullable: bool = field(default=True, metadata={'type': 'Element'})
class-attribute
instance-attribute
precision: int | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
type: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
type_oapif: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
type_oapif_format: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
type_wfs: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(name: str, type: str, is_primary_key: bool = False, is_generated: bool = False, type_wfs: str | None = None, type_oapif: str | None = None, type_oapif_format: str | None = None, alias: str | None = None, comment: str | None = None, nullable: bool = True, length: int | None = None, precision: int | None = None, editor_widget_type: str | None = None, editor_widget_type_wfs: str | None = None, editor_widget_type_oapif: str | None = None, editor_widget_type_oapif_format: str | None = None, editor_widget: EditorWidget | None = None, constraints: FieldConstraints | None = None) -> None
FieldConstraints
dataclass
Bases: BaseInterface
The constraints of a field as defined in QGIS (provider or layer).
Attributes:
-
not_null(bool) –If the field must not be NULL.
-
unique(bool) –If the field value must be unique.
-
expression(str | None) –The QGIS expression the field value has to fulfill.
Source code in src/qgis_server_light/interface/exporter/extract.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |
expression: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
not_null: bool = field(default=False, metadata={'type': 'Element'})
class-attribute
instance-attribute
unique: bool = field(default=False, metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(not_null: bool = False, unique: bool = False, expression: str | None = None) -> None
GdalSource
dataclass
Bases: Source
Source code in src/qgis_server_light/interface/exporter/extract.py
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 | |
layer_name: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
path: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
remote
property
to_qgis_decoded_uri: dict
property
vsi_prefix: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(path: str, layer_name: str | None = None, vsi_prefix: str | None = None) -> None
from_qgis_decoded_uri(decoded_uri: dict)
classmethod
Source code in src/qgis_server_light/interface/exporter/extract.py
265 266 267 268 269 270 271 | |
Group
dataclass
Bases: AbstractDataset
Holds meta information of a group. It's position in the tree and its children can be derived by id matching.
Source code in src/qgis_server_light/interface/exporter/extract.py
712 713 714 715 716 717 | |
is_expanded: bool = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(id: str, name: str, is_checked: bool, title: str, is_expanded: bool) -> None
LayerLike
dataclass
Bases: BaseInterface
Source code in src/qgis_server_light/interface/exporter/extract.py
16 17 18 19 20 | |
id: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
is_checked: bool = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
name: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(id: str, name: str, is_checked: bool) -> None
MetaData
dataclass
Bases: BaseInterface
Source code in src/qgis_server_light/interface/exporter/extract.py
756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 | |
author: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
categories: list[str] | None = field(default_factory=list, metadata={'type': 'Element'})
class-attribute
instance-attribute
creationDateTime: str = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
language: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
links: list[str] | None = field(default_factory=list, metadata={'type': 'Element'})
class-attribute
instance-attribute
service: Service = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(service: Service, links: list[str] | None = list(), language: str | None = None, categories: list[str] | None = list(), creationDateTime: str = None, author: str | None = None) -> None
__post_init__()
Source code in src/qgis_server_light/interface/exporter/extract.py
777 778 779 | |
OgrSource
dataclass
Bases: GdalSource
Source code in src/qgis_server_light/interface/exporter/extract.py
274 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 | |
encoded_uri_separator: str
property
layer_id: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
subset: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
to_qgis_decoded_uri: dict
property
__init__(path: str, layer_name: str | None = None, vsi_prefix: str | None = None, layer_id: str | None = None, subset: str | None = None) -> None
from_qgis_decoded_uri(decoded_uri: dict)
classmethod
Source code in src/qgis_server_light/interface/exporter/extract.py
288 289 290 291 292 293 294 295 296 297 | |
PostgresSource
dataclass
Bases: Source
Source code in src/qgis_server_light/interface/exporter/extract.py
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 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 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 | |
check_primary_key_unicity: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
dbname: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
geometry_column: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
host: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
key: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
password: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
port: int | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
redacted_fields: set
property
remote
property
schema: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
service: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
sql: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
srid: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
ssl_mode_text: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
sslmode: int | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
table: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
to_qgis_decoded_uri: dict
property
type: int | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
username: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(key: str, table: str, schema: str | None = None, geometry_column: str | None = None, dbname: str | None = None, host: str | None = None, password: str | None = None, port: int | None = None, type: int | None = None, username: str | None = None, srid: str | None = None, sslmode: int | None = None, ssl_mode_text: str | None = None, service: str | None = None, check_primary_key_unicity: str | None = None, sql: str | None = None) -> None
from_qgis_decoded_uri(decoded_uri: dict)
classmethod
Source code in src/qgis_server_light/interface/exporter/extract.py
547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 | |
Project
dataclass
Bases: BaseInterface
Source code in src/qgis_server_light/interface/exporter/extract.py
782 783 784 785 | |
name: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
version: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(version: str, name: str) -> None
Range
dataclass
Bases: BaseInterface
Configuration of the QGIS Range editor widget.
Attributes:
-
minimum(float | None) –The smallest allowed value.
-
maximum(float | None) –The biggest allowed value.
-
step(float | None) –The step of the widget.
Source code in src/qgis_server_light/interface/exporter/extract.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
maximum: float | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
minimum: float | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
step: float | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(minimum: float | None = None, maximum: float | None = None, step: float | None = None) -> None
Raster
dataclass
Bases: DataSet
A real QGIS Raster job_layer_definition. That are usually all QgsRasterLayer
in opposition to QgsVectorTileLayer
which is not a real QgsRasterLayer.
Source code in src/qgis_server_light/interface/exporter/extract.py
670 671 672 673 674 675 676 | |
__init__(id: str, name: str, is_checked: bool, title: str, source: DataSource, driver: str, bbox: BBox | None = None, bbox_wgs84: BBox | None = None, crs: Crs | None = None, styles: list[Style] = list(), minimum_scale: float | None = None, maximum_scale: float | None = None, style_name: str = 'default', is_spatial: bool = True, is_background: bool = False) -> None
Relation
dataclass
Bases: BaseInterface
Transportable form of a QGIS project relation (QgsRelation). The layers are
exported as QGIS layer ids, they are not resolved.
Attributes:
-
id(str) –The id of the relation, referenced by
RelationReference.relation_id. -
name(str) –The human readable name of the relation.
-
referencing_layer_id(str) –The QGIS layer id of the referencing (child) layer.
-
referenced_layer_id(str) –The QGIS layer id of the referenced (parent) layer.
-
field_pairs(list[RelationFieldPair]) –The field pairs, more than one for composite keys.
-
strength(str) –The strength as named by QGIS,
AssociationorComposition.
Source code in src/qgis_server_light/interface/exporter/extract.py
867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 | |
field_pairs: list[RelationFieldPair] = field(default_factory=list, metadata={'type': 'Element'})
class-attribute
instance-attribute
id: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
name: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
referenced_layer_id: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
referencing_layer_id: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
strength: str = field(default='Association', metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(id: str, name: str, referencing_layer_id: str, referenced_layer_id: str, field_pairs: list[RelationFieldPair] = list(), strength: str = 'Association') -> None
RelationFieldPair
dataclass
Bases: BaseInterface
One field pair of a QGIS project relation.
Attributes:
-
referencing_field(str) –The field of the referencing (child) layer.
-
referenced_field(str) –The field of the referenced (parent) layer.
Source code in src/qgis_server_light/interface/exporter/extract.py
853 854 855 856 857 858 859 860 861 862 863 864 | |
referenced_field: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
referencing_field: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(referencing_field: str, referenced_field: str) -> None
RelationReference
dataclass
Bases: BaseInterface
Configuration of the QGIS RelationReference editor widget.
Attributes:
-
relation_id(str) –The id of the project relation, see
Relation.id.
Source code in src/qgis_server_light/interface/exporter/extract.py
92 93 94 95 96 97 98 99 100 101 | |
relation_id: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(relation_id: str) -> None
ResultWithMessages
dataclass
Bases: BaseInterface
Source code in src/qgis_server_light/interface/exporter/extract.py
926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 | |
exporter: Exporter = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
has_errors: bool
property
messages: list[ExportMessage] = field(default_factory=list, kw_only=True, metadata={'type': 'Element'})
class-attribute
instance-attribute
project: Project = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(project: Project, exporter: Exporter, *, messages: list[ExportMessage] = list()) -> None
error(message: str, code: ExportMessage.Code, layer_id: str | None = None)
Source code in src/qgis_server_light/interface/exporter/extract.py
940 941 942 943 944 | |
warning(message: str, code: ExportMessage.Code, layer_id: str | None = None)
Source code in src/qgis_server_light/interface/exporter/extract.py
934 935 936 937 938 | |
Service
dataclass
Bases: BaseInterface
Source code in src/qgis_server_light/interface/exporter/extract.py
720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 | |
contact_mail: str | None = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
contact_organization: str | None = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
contact_person: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
contact_phone: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
contact_position: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
fees: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
keyword_list: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
online_resource: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
resource_url: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
service_abstract: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
service_title: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(contact_organization: str | None, contact_mail: str | None, contact_person: str | None = None, contact_phone: str | None = None, contact_position: str | None = None, fees: str | None = None, keyword_list: str | None = None, online_resource: str | None = None, service_abstract: str | None = None, service_title: str | None = None, resource_url: str | None = None) -> None
Source
dataclass
Bases: BaseInterface, ABC
Source code in src/qgis_server_light/interface/exporter/extract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | |
to_qgis_decoded_uri: dict
property
__init__() -> None
decide_remote(path: str) -> bool
staticmethod
Source code in src/qgis_server_light/interface/exporter/extract.py
229 230 231 | |
from_qgis_decoded_uri(decoded_uri: dict)
classmethod
Source code in src/qgis_server_light/interface/exporter/extract.py
239 240 241 242 243 | |
Tree
dataclass
Bases: BaseInterface
Source code in src/qgis_server_light/interface/exporter/extract.py
788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 | |
members: list[TreeGroup] = field(default_factory=list, metadata={'type': 'Element'})
class-attribute
instance-attribute
root
property
__init__(members: list[TreeGroup] = list()) -> None
find_by_id(identifier: str) -> TreeGroup | None
Source code in src/qgis_server_light/interface/exporter/extract.py
805 806 807 808 809 | |
find_by_name(name: str) -> TreeGroup | None
Source code in src/qgis_server_light/interface/exporter/extract.py
799 800 801 802 803 | |
TreeGroup
dataclass
Bases: TreeLayer
Source code in src/qgis_server_light/interface/exporter/extract.py
28 29 30 31 | |
children: list[str] = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
is_expanded: bool = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(id: str, name: str, is_checked: bool, children: list[str], is_expanded: bool) -> None
TreeLayer
dataclass
Bases: LayerLike
Source code in src/qgis_server_light/interface/exporter/extract.py
23 24 25 | |
__init__(id: str, name: str, is_checked: bool) -> None
ValueMap
dataclass
Bases: BaseInterface
Configuration of the QGIS ValueMap editor widget.
Attributes:
-
entries(list[ValueMapEntry]) –The key / description pairs in the order defined in QGIS. The entry representing NULL is not part of it.
-
null_representation(str | None) –The description QGIS shows for NULL, if the widget defines one.
Source code in src/qgis_server_light/interface/exporter/extract.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
entries: list[ValueMapEntry] = field(default_factory=list, metadata={'type': 'Element'})
class-attribute
instance-attribute
null_representation: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(entries: list[ValueMapEntry] = list(), null_representation: str | None = None) -> None
ValueMapEntry
dataclass
Bases: BaseInterface
One entry of a QGIS ValueMap editor widget.
Attributes:
-
key(str) –The value which is stored in the field.
-
description(str) –The human readable representation of the value.
Source code in src/qgis_server_light/interface/exporter/extract.py
34 35 36 37 38 39 40 41 42 43 44 45 | |
description: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
key: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(key: str, description: str) -> None
ValueRelation
dataclass
Bases: BaseInterface
Configuration of the QGIS ValueRelation editor widget. The referenced layer is
exported as QGIS layer id, it is not resolved.
Attributes:
-
layer_id(str) –The QGIS layer id of the layer the values are taken from.
-
key_field(str) –The field of the referenced layer which is stored.
-
value_field(str) –The field of the referenced layer which is shown.
-
filter_expression(str | None) –The QGIS expression to filter the referenced layer. It may use form context functions like
current_value(). -
allow_multi(bool) –If more than one value can be selected.
-
order_by_value(bool) –If the values are ordered by the value field instead of the key field.
Source code in src/qgis_server_light/interface/exporter/extract.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |
allow_multi: bool = field(default=False, metadata={'type': 'Element'})
class-attribute
instance-attribute
filter_expression: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
key_field: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
layer_id: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
order_by_value: bool = field(default=False, metadata={'type': 'Element'})
class-attribute
instance-attribute
value_field: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(layer_id: str, key_field: str, value_field: str, filter_expression: str | None = None, allow_multi: bool = False, order_by_value: bool = False) -> None
Vector
dataclass
Bases: DataSet
A real QGIS Vector job_layer_definition. That are usually all QgsVectorLayer
in opposition to QgsVectorTileLayer
which is not a real QgsVectorLayer.
Source code in src/qgis_server_light/interface/exporter/extract.py
679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 | |
fields: list[Field] = field(default_factory=list, metadata={'type': 'Element'})
class-attribute
instance-attribute
geometry_type_simple: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
geometry_type_wkb: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(id: str, name: str, is_checked: bool, title: str, source: DataSource, driver: str, bbox: BBox | None = None, bbox_wgs84: BBox | None = None, crs: Crs | None = None, styles: list[Style] = list(), minimum_scale: float | None = None, maximum_scale: float | None = None, style_name: str = 'default', is_spatial: bool = True, is_background: bool = False, fields: list[Field] = list(), geometry_type_simple: str | None = None, geometry_type_wkb: str | None = None) -> None
get_field_by_name(name: str) -> Field | None
Source code in src/qgis_server_light/interface/exporter/extract.py
700 701 702 703 704 | |
VectorTileSource
dataclass
Bases: Source
Source code in src/qgis_server_light/interface/exporter/extract.py
574 575 576 577 578 579 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 607 | |
path: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
remote
property
style_url: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
to_qgis_decoded_uri: dict
property
type: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
url: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
zmax: int | None = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
zmin: int | None = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(type: str, zmin: int | None, zmax: int | None, url: str | None = None, path: str | None = None, style_url: str | None = None) -> None
from_qgis_decoded_uri(decoded_uri: dict)
classmethod
Source code in src/qgis_server_light/interface/exporter/extract.py
598 599 600 601 602 603 604 605 606 607 | |
WcsSource
dataclass
Bases: Source
Source of a layer of the QGIS wcs provider. The attributes are the uri
parameters read by the provider (QgsWcsProvider::parseUri and
QgsWcsCapabilities in QGIS src/providers/wcs). Credentials (username,
password, authcfg) and http headers are intentionally not exported.
Source code in src/qgis_server_light/interface/exporter/extract.py
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 | |
bbox: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
cache: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
crs: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
format: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
identifier: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
ignore_axis_orientation: bool = field(default=False, metadata={'type': 'Element'})
class-attribute
instance-attribute
ignore_get_map_url: bool = field(default=False, metadata={'type': 'Element'})
class-attribute
instance-attribute
invert_axis_orientation: bool = field(default=False, metadata={'type': 'Element'})
class-attribute
instance-attribute
remote
property
time: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
to_qgis_decoded_uri: dict
property
url: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
version: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(url: str, identifier: str, crs: str | None = None, format: str | None = None, time: str | None = None, bbox: str | None = None, version: str | None = None, cache: str | None = None, ignore_get_map_url: bool = False, ignore_axis_orientation: bool = False, invert_axis_orientation: bool = False) -> None
from_qgis_decoded_uri(decoded_uri: dict)
classmethod
Source code in src/qgis_server_light/interface/exporter/extract.py
474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 | |
WfsSource
dataclass
Bases: BaseInterface
Source code in src/qgis_server_light/interface/exporter/extract.py
304 305 306 307 308 | |
__init__() -> None
WmsSource
dataclass
Bases: Source
Source code in src/qgis_server_light/interface/exporter/extract.py
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 | |
contextual_wms_legend: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
crs: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
dpi_mode: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
feature_count: int | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
format: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
layers: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
remote
property
styles: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
to_qgis_decoded_uri: dict
property
url: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(crs: str, format: str, layers: str, url: str, dpi_mode: str | None = None, feature_count: int | None = None, contextual_wms_legend: str | None = None, styles: str | None = None) -> None
from_qgis_decoded_uri(decoded_uri: dict)
classmethod
Source code in src/qgis_server_light/interface/exporter/extract.py
370 371 372 373 374 375 376 377 378 379 380 381 | |
WmtsSource
dataclass
Bases: WmsSource
Source code in src/qgis_server_light/interface/exporter/extract.py
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 | |
tile_dimensions: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
tile_matrix_set: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
tile_pixel_ratio: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
to_qgis_decoded_uri: dict
property
__init__(crs: str, format: str, layers: str, url: str, dpi_mode: str | None = None, feature_count: int | None = None, contextual_wms_legend: str | None = None, styles: str | None = None, *, tile_matrix_set: str, tile_dimensions: str | None = None, tile_pixel_ratio: str | None = None) -> None
from_qgis_decoded_uri(decoded_uri: dict)
classmethod
Source code in src/qgis_server_light/interface/exporter/extract.py
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | |
XYZSource
dataclass
Bases: Source
Source code in src/qgis_server_light/interface/exporter/extract.py
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 | |
remote
property
to_qgis_decoded_uri: dict
property
type: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
url: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
zmax: int | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
zmin: int | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(url: str, zmin: int | None = None, zmax: int | None = None, type: str | None = None) -> None
from_qgis_decoded_uri(decoded_uri: dict)
classmethod
Source code in src/qgis_server_light/interface/exporter/extract.py
328 329 330 331 332 333 334 335 | |
job
common
input
AbstractFilter
dataclass
Bases: BaseInterface
Source code in src/qgis_server_light/interface/job/common/input.py
66 67 68 69 70 71 72 | |
definition: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
shortened_fields: set
property
__init__(definition: str) -> None
ExecutionMode
Bases: Enum
If the dispatcher waits for the job (SYNC) or asks for its state later
(ASYNC). Only jobs which keep their state (RedisStateProtocol) use it.
Source code in src/qgis_server_light/interface/job/common/input.py
17 18 19 20 21 22 23 | |
ASYNC = 'async'
class-attribute
instance-attribute
SYNC = 'sync'
class-attribute
instance-attribute
OgcFilter110
dataclass
Bases: AbstractFilter
A filter which definition conforms to
https://schemas.opengis.net/filter/1.1.0/filter.xsd
and which is consumable by qgis.core.QgsOgcUtils.expressionFromOgcFilter.
Source code in src/qgis_server_light/interface/job/common/input.py
75 76 77 78 79 80 81 | |
__init__(definition: str) -> None
OgcFilterFES20
dataclass
Bases: AbstractFilter
A filter which definition conforms to https://www.opengis.net/fes/2.0
and which is consumable by qgis.core.QgsOgcUtils.expressionFromOgcFilter.
Source code in src/qgis_server_light/interface/job/common/input.py
84 85 86 87 88 89 | |
__init__(definition: str) -> None
QslJobInfoParameter
dataclass
Bases: ABC
The common minimal interface of a job which is shipped around. Each job for QSL has to implement at least this interface.
Attributes:
-
id(str) –The unique identifier which is used to recognize the job all over its lifecycle.
-
type(str) –A string based identifier of the job, this is used to quickly determine its nature serialized state.
-
job(QslJobParameter) –The actual job parameters. This is a domain specific dataclass depending on the nature of the actual job.
-
execution_mode(ExecutionMode) –With
ExecutionMode.SYNCthe worker notifies the waiting dispatcher when the job is finished. Only used by jobs which keep their state.
Source code in src/qgis_server_light/interface/job/common/input.py
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 | |
channel_name: str
property
execution_mode: ExecutionMode = field(metadata={'type': 'Element'}, default=(ExecutionMode.SYNC))
class-attribute
instance-attribute
id: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
job: QslJobParameter = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
type: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(id: str, type: str, job: QslJobParameter, execution_mode: ExecutionMode = ExecutionMode.SYNC) -> None
QslJobLayer
dataclass
Bases: BaseInterface
Source code in src/qgis_server_light/interface/job/common/input.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
driver: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
filter: OgcFilter110 | OgcFilterFES20 | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
folder_name: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
id: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
name: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
redacted_fields: set
property
remote: bool = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
source: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
style: Style | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(id: str, name: str, source: str, remote: bool, folder_name: str, driver: str, style: Style | None = None, filter: OgcFilter110 | OgcFilterFES20 | None = None) -> None
QslJobParameter
dataclass
Bases: ABC
The minimal interface of a job parameter interface. In the domain specific refinement it holds the relevant information about a job.
Source code in src/qgis_server_light/interface/job/common/input.py
8 9 10 11 12 13 14 | |
__init__() -> None
QslJobParameterMapRelated
dataclass
Bases: QslJobParameter
The minimal interface of a job parameter interface for jobs rendering things in the end.
Attributes:
-
svg_paths(list[str]) –A list of paths to svg's (folders) which are necessary for the job to render nicely.
Source code in src/qgis_server_light/interface/job/common/input.py
54 55 56 57 58 59 60 61 62 63 | |
svg_paths: list[str] = field(default_factory=list, metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(svg_paths: list[str] = list()) -> None
output
JobResult
dataclass
Bases: BaseInterface
Source code in src/qgis_server_light/interface/job/common/output.py
7 8 9 10 11 12 13 14 15 16 17 | |
content_type: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
data: Any = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
id: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
shortened_fields: set
property
worker_host_name: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
worker_id: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(id: str, data: Any, content_type: str, worker_id: str | None = None, worker_host_name: str | None = None) -> None
crs
input
QslJobInfoCrs
dataclass
Bases: QslJobInfoParameter
Source code in src/qgis_server_light/interface/job/crs/input.py
22 23 24 | |
job: QslJobParameterCrs = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(id: str, type: str, job: QslJobParameterCrs, execution_mode: ExecutionMode = ExecutionMode.SYNC) -> None
QslJobParameterCrs
dataclass
Bases: QslJobParameter
Resolves crs identifiers into the full crs information as QGIS knows it. This way consuming applications get all identifiers and the axis order without own crs knowledge.
Attributes:
-
identifiers(list[str]) –The crs identifiers to resolve, e.g.
EPSG:4326, URN or URI notation.
Source code in src/qgis_server_light/interface/job/crs/input.py
9 10 11 12 13 14 15 16 17 18 19 | |
identifiers: list[str] = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(identifiers: list[str]) -> None
output
CrsCollection
dataclass
Bases: BaseInterface
Holds the resolved crs. The order in the list has to be not changed, so that consuming applications can map the response to the passed identifiers.
Attributes:
Source code in src/qgis_server_light/interface/job/crs/output.py
6 7 8 9 10 11 12 13 14 15 16 17 18 | |
crs: list[Crs] = field(default_factory=list, metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(crs: list[Crs] = list()) -> None
feature
input
FeatureQuery
dataclass
Bases: BaseInterface
Represents definitions of a query to obtain features from a list of layers. Be aware, that filters are not applied to the QslJobLayer in this implementation since passed filters can contain inter-layer-references.
Attributes:
-
layers(list[QslJobLayer]) –A list layers which should only reference vector sources and be queried.
-
aliases(list[str]) –An optional list of alias names. This has to be the same length as the
-
filter(OgcFilterFES20) –An optional filter which might reference all passed layers thats why layers has to be added
-
crs(Crs | None) –An optional crs the geometries of the features are transformed to. If not set, geometries stay in the crs of the layer.
Source code in src/qgis_server_light/interface/job/feature/input.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |
aliases: list[str] = field(default_factory=list, metadata={'type': 'Element'})
class-attribute
instance-attribute
crs: Crs | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
filter: OgcFilterFES20 = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
layers: list[QslJobLayer] = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(layers: list[QslJobLayer], aliases: list[str] = list(), filter: OgcFilterFES20 = None, crs: Crs | None = None) -> None
QslJobInfoFeature
dataclass
Bases: QslJobInfoParameter
Source code in src/qgis_server_light/interface/job/feature/input.py
60 61 62 | |
job: QslJobParameterFeature = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(id: str, type: str, job: QslJobParameterFeature, execution_mode: ExecutionMode = ExecutionMode.SYNC) -> None
QslJobParameterFeature
dataclass
Bases: QslJobParameter
As defined in WFS 2.0 specs, a request can be subdivided in a list of queries. This class is representing that.
Attributes:
-
queries(list[FeatureQuery]) –A list of queries which features should be extracted for.
-
start_index(int) –The offset for paging reason.
-
count(int | None) –The number of results to return.
Source code in src/qgis_server_light/interface/job/feature/input.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
count: int | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
queries: list[FeatureQuery] = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
start_index: int = field(default=0, metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(queries: list[FeatureQuery], start_index: int = 0, count: int | None = None) -> None
output
Attribute
dataclass
Bases: BaseInterface
An attribute belonging to a feature. The aim here is to drill down to simple types which can be used in consuming applications without further handling. This does not include the geometry attribute!
Attributes:
-
name(str) –The name of the attribute. Has to match with the name used for exported fields with
Fieldclass. -
value(int | float | str | bool | bytes | None) –Value as simple as possible. It has to be pickleable
Source code in src/qgis_server_light/interface/job/feature/output.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |
name: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
value: int | float | str | bool | bytes | None = field(metadata={'type': 'Element', 'format': 'base64'})
class-attribute
instance-attribute
__init__(name: str, value: int | float | str | bool | bytes | None) -> None
Feature
dataclass
Bases: BaseInterface
Feature to hold information of extracted QgsFeature.
Attributes:
-
geometry(Geometry | None) –The geometry representing the feature.
-
attributes(list[Attribute]) –List of attributes defined in this feature.
Source code in src/qgis_server_light/interface/job/feature/output.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |
attributes: list[Attribute] = field(default_factory=list, metadata={'type': 'Element'})
class-attribute
instance-attribute
geometry: Geometry | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(geometry: Geometry | None = None, attributes: list[Attribute] = list()) -> None
FeatureCollection
dataclass
Bases: BaseInterface
This construction is used to abstract the content of extracted features for pickelable transportation from QSL to the queue. This way we ensure how things are constructed and transported.
Attributes:
-
name(str) –The name of the feature collection. This is the key to match it to requested layers.
-
features(list[Feature]) –The features belonging to the feature collection.
Source code in src/qgis_server_light/interface/job/feature/output.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
features: list[Feature] = field(default_factory=list, metadata={'type': 'Element'})
class-attribute
instance-attribute
name: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(name: str, features: list[Feature] = list()) -> None
Geometry
dataclass
Bases: Attribute
Source code in src/qgis_server_light/interface/job/feature/output.py
27 28 29 30 31 32 33 34 | |
name: str = field(default='geometry', metadata={'type': 'Element'})
class-attribute
instance-attribute
shortened_fields: set
property
value: bytes | None = field(default=None, metadata={'type': 'Element', 'format': 'base64'})
class-attribute
instance-attribute
__init__(name: str = 'geometry', value: bytes | None = None) -> None
QueryCollection
dataclass
Bases: BaseInterface
Holds all feature collections which are bound to the passed queries. The order in the list has to be not changed, so that consuming applications can map the response to the passed queries.
Attributes:
-
numbers_matched(str | int) –Information about how many matches are fund for the executed query.
-
feature_collections(list[FeatureCollection]) –The feature collections belonging to the passed queries.
Source code in src/qgis_server_light/interface/job/feature/output.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
feature_collections: list[FeatureCollection] = field(default_factory=list, metadata={'type': 'Element'})
class-attribute
instance-attribute
numbers_matched: str | int = field(default='unknown', metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(numbers_matched: str | int = 'unknown', feature_collections: list[FeatureCollection] = list()) -> None
feature_info
input
QslJobInfoFeatureInfo
dataclass
Bases: QslJobInfoParameter
Source code in src/qgis_server_light/interface/job/feature_info/input.py
42 43 44 | |
job: QslJobParameterFeatureInfo = field(metadata={'type': 'Element', 'required': True})
class-attribute
instance-attribute
__init__(id: str, type: str, job: QslJobParameterFeatureInfo, execution_mode: ExecutionMode = ExecutionMode.SYNC) -> None
QslJobParameterFeatureInfo
dataclass
Bases: QslJobParameter
A runner to extract feature info
Source code in src/qgis_server_light/interface/job/feature_info/input.py
9 10 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 | |
I: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
INFO_FORMAT: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
J: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
QUERY_LAYERS: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
X: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
Y: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
decide_x: int
property
decide_y: int
property
query_layers_list
property
__init__(*, INFO_FORMAT: str, QUERY_LAYERS: str, X: str | None = None, Y: str | None = None, I: str | None = None, J: str | None = None) -> None
__post_init__()
Source code in src/qgis_server_light/interface/job/feature_info/input.py
21 22 23 24 25 26 27 | |
output
legend
input
QslJobInfoLegend
dataclass
Bases: QslJobInfoParameter
Source code in src/qgis_server_light/interface/job/legend/input.py
29 30 31 | |
job: QslJobParameterLegend = field(metadata={'type': 'Element', 'required': True})
class-attribute
instance-attribute
__init__(id: str, type: str, job: QslJobParameterLegend, execution_mode: ExecutionMode = ExecutionMode.SYNC) -> None
QslJobParameterLegend
dataclass
Bases: QslJobParameter
Render legend graphics for one or more layers.
Source code in src/qgis_server_light/interface/job/legend/input.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
dpi: int = field(default=91, metadata={'type': 'Element'})
class-attribute
instance-attribute
format: str = field(default='image/png', metadata={'type': 'Element'})
class-attribute
instance-attribute
height: int | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
layer_title: bool = field(default=False, metadata={'type': 'Element'})
class-attribute
instance-attribute
layers: list[QslJobLayer] = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
scale: float | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
width: int | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(*, layers: list[QslJobLayer], format: str = 'image/png', width: int | None = None, height: int | None = None, dpi: int = 91, scale: float | None = None, layer_title: bool = False) -> None
get_layer_by_name(name: str) -> QslJobLayer
Source code in src/qgis_server_light/interface/job/legend/input.py
22 23 24 25 26 | |
output
process
description
This module contains the description of the processes a process-worker serves. It is shaped along the process description of OGC API - Processes - Part 1: Core (https://schemas.opengis.net/ogcapi/processes/part1/1.0/openapi/schemas/process.yaml), so a consumer can expose its elements as they are and only adds what belongs to the API around (links, job control options, conformance, ...).
Optional values default to None. Serialized with
xsdata.formats.dataclass.serializers.dict.DictFactory.FILTER_NONE they are left out,
which gives a plain JSON Schema for each Schema.
QSL_LAYER_FORMAT = 'qsl-layer'
module-attribute
InputDescription
dataclass
Bases: BaseInterface
The description of one input of a process.
OGC API - Processes holds the inputs as map by id. xsdata can't bind a map of dataclasses, therefore the id is part of the description and the inputs are a list.
Attributes:
-
id(str) –The identifier of the input, the QGIS parameter name.
-
title(str) –Human readable name.
-
description(str | None) –Human readable help text.
-
schema(Schema) –The schema of one value.
-
min_occurs(int) –The minimal number of values.
-
max_occurs(int | str) –The maximal number of values,
unboundedfor any.
Source code in src/qgis_server_light/interface/job/process/description.py
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 | |
description: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
id: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
max_occurs: int | str = field(default=1, metadata={'type': 'Element', 'name': 'maxOccurs'})
class-attribute
instance-attribute
min_occurs: int = field(default=1, metadata={'type': 'Element', 'name': 'minOccurs'})
class-attribute
instance-attribute
schema: Schema = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
shortened_fields: set
property
title: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(*, id: str, title: str, description: str | None = None, schema: Schema, min_occurs: int = 1, max_occurs: int | str = 1) -> None
OutputDescription
dataclass
Bases: BaseInterface
The description of one output of a process. The id is part of the description,
see InputDescription.
Attributes:
-
id(str) –The identifier of the output, the QGIS output name.
-
title(str) –Human readable name.
-
schema(Schema) –The schema of the value.
Source code in src/qgis_server_light/interface/job/process/description.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 | |
id: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
schema: Schema = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
title: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(*, id: str, title: str, schema: Schema) -> None
ProcessDescription
dataclass
Bases: BaseInterface
The description of one process.
Attributes:
-
id(str) –The identifier of the process, the QGIS algorithm id.
-
title(str) –Human readable name.
-
description(str | None) –Human readable help text.
-
inputs(list[InputDescription]) –The inputs which are passed by the client. Destinations are not part of it, they are set by the worker.
-
outputs(list[OutputDescription]) –The outputs the process produces.
-
internal(bool | None) –If the process is for internal use of the consumer only and must not be published. Left out (
None) for a publishable process.
Source code in src/qgis_server_light/interface/job/process/description.py
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 | |
description: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
id: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
inputs: list[InputDescription] = field(default_factory=list, metadata={'type': 'Element'})
class-attribute
instance-attribute
internal: bool | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
outputs: list[OutputDescription] = field(default_factory=list, metadata={'type': 'Element'})
class-attribute
instance-attribute
shortened_fields: set
property
title: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(*, id: str, title: str, description: str | None = None, inputs: list[InputDescription] = list(), outputs: list[OutputDescription] = list(), internal: bool | None = None) -> None
ProcessDescriptions
dataclass
Bases: BaseInterface
The processes a process-worker serves (see RedisProtocol.worker_processes_key),
or all process-workers together as the dispatcher merges them.
Attributes:
-
processes(list[ProcessDescription]) –The description per process.
-
warnings(list[ProcessWarning]) –The processes the workers don't agree on, only set by the dispatcher.
Source code in src/qgis_server_light/interface/job/process/description.py
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 | |
processes: list[ProcessDescription] = field(default_factory=list, metadata={'type': 'Element'})
class-attribute
instance-attribute
warnings: list[ProcessWarning] = field(default_factory=list, metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(processes: list[ProcessDescription] = list(), warnings: list[ProcessWarning] = list()) -> None
process_by_id(process_id: str) -> ProcessDescription
Parameters:
-
process_id(str) –The identifier of the process.
Raises:
-
LookupError–If no process with this id is described.
Source code in src/qgis_server_light/interface/job/process/description.py
187 188 189 190 191 192 193 194 195 196 197 198 | |
ProcessWarning
dataclass
Bases: BaseInterface
Tells that the process-workers serving a process don't agree on it. They run different QGIS versions or describe the process differently, so a job behaves differently depending on the worker which takes it. The deployment needs to be corrected then.
Attributes:
-
process_id(str) –The identifier of the process.
-
qgis_versions(list[str]) –The QGIS versions of the workers serving the process, the newest first.
-
descriptions_differ(bool) –If the workers describe the process differently.
Source code in src/qgis_server_light/interface/job/process/description.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
descriptions_differ: bool = field(default=False, metadata={'type': 'Element'})
class-attribute
instance-attribute
process_id: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
qgis_versions: list[str] = field(default_factory=list, metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(*, process_id: str, qgis_versions: list[str] = list(), descriptions_differ: bool = False) -> None
QslLayerKind
Bases: Enum
The kinds of layer QSL can load as value of a process input.
Source code in src/qgis_server_light/interface/job/process/description.py
20 21 22 23 24 | |
RASTER = 'raster'
class-attribute
instance-attribute
VECTOR = 'vector'
class-attribute
instance-attribute
QslLayerMarker
dataclass
Bases: BaseInterface
Marks a schema whose value is a layer (QslJobLayer) instead of a literal. A
consumer replaces the marked schema with the layers it offers which match the marker.
Attributes:
-
kinds(list[QslLayerKind]) –The kinds of layer which are accepted.
-
geometry_types(list[str]) –The geometry types of a vector layer which are accepted, named as
qgis.core.Qgis.GeometryType(Point,Line,Polygon,Null). MatchesVector.geometry_type_simpleof the exported project. Applies to vector layers only, empty when no vector layer is accepted. -
source(str | None) –The class name of the QGIS parameter or output the marker was derived from.
Source code in src/qgis_server_light/interface/job/process/description.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
geometry_types: list[str] = field(default_factory=list, metadata={'type': 'Element'})
class-attribute
instance-attribute
kinds: list[QslLayerKind] = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
source: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(kinds: list[QslLayerKind], geometry_types: list[str] = list(), source: str | None = None) -> None
Schema
dataclass
Bases: BaseInterface
The subset of JSON Schema which is used to describe the values of inputs and outputs.
Attributes:
-
type(str | None) –The JSON Schema type (
string,number,integer,boolean, ...). -
format(str | None) –The format of the value. Layer values carry
QSL_LAYER_FORMAT. -
title(str | None) –Human readable name, used on the entries of
one_of. -
minimum(int | float | None) –The inclusive minimum of a numeric value.
-
maximum(int | float | None) –The inclusive maximum of a numeric value.
-
const(bool | int | float | str | None) –The only valid value, used on the entries of
one_of. -
default(bool | int | float | str | None) –The value used when none is passed.
-
one_of(list[Schema] | None) –The valid values, each as schema with
constandtitle. For a file output the formats it is offered in, each as schema withcontent_media_type, the first one is the default. -
content_media_type(str | None) –The media type of a value which is a file.
-
x_qsl_layer(QslLayerMarker | None) –The marker of a layer value.
Source code in src/qgis_server_light/interface/job/process/description.py
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 | |
const: bool | int | float | str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
content_media_type: str | None = field(default=None, metadata={'type': 'Element', 'name': 'contentMediaType'})
class-attribute
instance-attribute
default: bool | int | float | str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
format: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
maximum: int | float | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
minimum: int | float | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
one_of: list[Schema] | None = field(default=None, metadata={'type': 'Element', 'name': 'oneOf'})
class-attribute
instance-attribute
title: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
type: str | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
x_qsl_layer: QslLayerMarker | None = field(default=None, metadata={'type': 'Element', 'name': 'x-qsl-layer'})
class-attribute
instance-attribute
__init__(*, type: str | None = None, format: str | None = None, title: str | None = None, minimum: int | float | None = None, maximum: int | float | None = None, const: bool | int | float | str | None = None, default: bool | int | float | str | None = None, one_of: list[Schema] | None = None, content_media_type: str | None = None, x_qsl_layer: QslLayerMarker | None = None) -> None
input
This module contains the execute request of a process job. It is shaped along the
execute request of OGC API - Processes - Part 1: Core
(https://schemas.opengis.net/ogcapi/processes/part1/1.0/openapi/schemas/execute.yaml),
carrying its inputs and outputs. OGC API - Processes holds them as maps by id, xsdata
can't bind a map of dataclasses, therefore the id is part of each entry and they are lists
(see InputDescription).
ExecuteInput
dataclass
The value of one input of a process.
Attributes:
-
id(str) –The identifier of the input, the QGIS parameter name.
-
value(list[QslJobLayer | str | int | float | bool]) –The values of the input, one entry for an input taking a single value. A layer value is substituted in place by its
QslJobLayer.
Source code in src/qgis_server_light/interface/job/process/input.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |
id: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
value: list[QslJobLayer | str | int | float | bool] = field(default_factory=list, metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(id: str, value: list[QslJobLayer | str | int | float | bool] = list()) -> None
ExecuteOutput
dataclass
The format a client wants a file output in.
Attributes:
-
id(str) –The identifier of the output, the QGIS output name.
-
format(Format) –The format the output is written in.
Source code in src/qgis_server_light/interface/job/process/input.py
45 46 47 48 49 50 51 52 53 54 55 | |
format: Format = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
id: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(id: str, format: Format) -> None
Format
dataclass
The format of a file output.
Attributes:
-
media_type(str) –One of the media types the description offers for the output.
Source code in src/qgis_server_light/interface/job/process/input.py
34 35 36 37 38 39 40 41 42 | |
media_type: str = field(metadata={'type': 'Element', 'name': 'mediaType'})
class-attribute
instance-attribute
__init__(media_type: str) -> None
QslJobInfoExecuteProcess
dataclass
Bases: QslJobInfoParameter
The job of a process execution, queued with RedisStateQueue.submit.
Source code in src/qgis_server_light/interface/job/process/input.py
74 75 76 77 78 | |
job: QslJobParameterExecuteProcess = field(metadata={'type': 'Element', 'required': True})
class-attribute
instance-attribute
__init__(id: str, type: str, job: QslJobParameterExecuteProcess, execution_mode: ExecutionMode = ExecutionMode.SYNC) -> None
QslJobParameterExecuteProcess
dataclass
Bases: QslJobParameter
The execute request of a process.
Attributes:
-
process_id(str) –The identifier of the process, the QGIS algorithm id.
-
inputs(list[ExecuteInput]) –The values of the inputs, an input which is left out takes its default.
-
outputs(list[ExecuteOutput]) –The formats chosen for file outputs, an output which is left out is written in the first format its description offers.
Source code in src/qgis_server_light/interface/job/process/input.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
inputs: list[ExecuteInput] = field(default_factory=list, metadata={'type': 'Element'})
class-attribute
instance-attribute
outputs: list[ExecuteOutput] = field(default_factory=list, metadata={'type': 'Element'})
class-attribute
instance-attribute
process_id: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(*, process_id: str, inputs: list[ExecuteInput] = list(), outputs: list[ExecuteOutput] = list()) -> None
output
This module contains the result of a process job. It is shaped along the results of
OGC API - Processes - Part 1: Core
(https://schemas.opengis.net/ogcapi/processes/part1/1.0/openapi/schemas/results.yaml),
per output either the literal value or a reference to the file. The outputs are a list of
entries with their id instead of a map by id, see ExecuteInput.
ProcessResult
dataclass
Bases: BaseInterface
The result of a process. A worker ships it as xsdata JSON in the data of
the JobResult, so the dispatcher can parse it back without knowing
anything about QGIS.
Attributes:
-
outputs(list[ResultOutput]) –The outputs of the process.
-
log(str) –The log the QGIS algorithm wrote while it was running. It has no place in the results of OGC API - Processes and travels next to the outputs.
Source code in src/qgis_server_light/interface/job/process/output.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
log: str = field(default='', metadata={'type': 'Element'})
class-attribute
instance-attribute
outputs: list[ResultOutput] = field(default_factory=list, metadata={'type': 'Element'})
class-attribute
instance-attribute
shortened_fields: set
property
__init__(outputs: list[ResultOutput] = list(), log: str = '') -> None
Reference
dataclass
A file a process wrote into the process output dir of the worker.
Attributes:
-
href(str) –The path of the file relative to the process output dir.
-
type(str) –The media type of the file.
Source code in src/qgis_server_light/interface/job/process/output.py
13 14 15 16 17 18 19 20 21 22 23 | |
href: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
type: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(href: str, type: str) -> None
ResultOutput
dataclass
A single output of a process, the counterpart of ExecuteInput.
Attributes:
-
id(str) –The identifier of the output, the QGIS output name.
-
value(Reference | str | int | float | bool) –The file the output was written to, or the literal value of the output.
Source code in src/qgis_server_light/interface/job/process/output.py
26 27 28 29 30 31 32 33 34 35 36 37 | |
id: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
value: Reference | str | int | float | bool = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(id: str, value: Reference | str | int | float | bool) -> None
render
input
QslJobInfoRender
dataclass
Bases: QslJobInfoParameter
Source code in src/qgis_server_light/interface/job/render/input.py
30 31 32 | |
job: QslJobParameterRender = field(metadata={'type': 'Element', 'required': True})
class-attribute
instance-attribute
__init__(id: str, type: str, job: QslJobParameterRender, execution_mode: ExecutionMode = ExecutionMode.SYNC) -> None
QslJobParameterRender
dataclass
Bases: QslJobParameter
A runner to be rendered as an image
Source code in src/qgis_server_light/interface/job/render/input.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | |
bbox: BBox = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
crs: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
dpi: int | None = field(default=None, metadata={'type': 'Element'})
class-attribute
instance-attribute
format: str = field(default='image/png', metadata={'type': 'Element'})
class-attribute
instance-attribute
height: int = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
layers: list[QslJobLayer] = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
width: int = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(*, layers: list[QslJobLayer], bbox: BBox, crs: str, width: int, height: int, dpi: int | None = None, format: str = 'image/png') -> None
get_layer_by_name(name: str) -> QslJobLayer
Source code in src/qgis_server_light/interface/job/render/input.py
23 24 25 26 27 | |
output
worker
info
This part defines the structure how a running QSL worker exposes its capabilities.
EngineInfo
dataclass
Source code in src/qgis_server_light/interface/worker/info.py
33 34 35 36 37 38 | |
id: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
qgis_info: QgisInfo = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
started: float = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
status: Status = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(id: str, qgis_info: QgisInfo, status: Status, started: float) -> None
QgisInfo
dataclass
Information container to ship minimal knowledge of the underlying QGIS.
Attributes:
-
version(int) –The integer representation of the QGIS version e.g. 34400
-
version_name(str) –The string representation which also includes the codename e.g. "QGIS Version 4.0.0-Norrköping"
Source code in src/qgis_server_light/interface/worker/info.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
path: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
version: int = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
version_name: str = field(metadata={'type': 'Element'})
class-attribute
instance-attribute
__init__(version: int, version_name: str, path: str) -> None
Status
Bases: StrEnum
Source code in src/qgis_server_light/interface/worker/info.py
8 9 10 11 12 | |
CRASHED = 'crashed'
class-attribute
instance-attribute
PROCESSING = 'processing'
class-attribute
instance-attribute
STARTING = 'starting'
class-attribute
instance-attribute
WAITING = 'waiting'
class-attribute
instance-attribute
processing
This package contains the processing handling shared by the exporter and the worker. It is the only place where QGIS processing definitions are translated into the QGIS-Server-Light interface.
description
This module translates QGIS processing algorithms into the process descriptions of the
QGIS-Server-Light interface (interface.job.process.description), shaped along
OGC API - Processes.
The schemas are mapped with the strategy pattern. Each kind of QGIS parameter or output
definition has its SchemaStrategy, ProcessDescriptionMapper picks it from a flat
lookup table by the exact QGIS class. The layer strategies share the derivation of the
QslLayerMarker as template method (LayerSchemaStrategy.map_schema), each one only
tells which source types it accepts.
It was chosen because QGIS knows many definition classes and each one maps differently. Supporting a new one is one strategy and one entry in the table, nothing else changes. The exact class is looked up on purpose: a QGIS subclass is never served by accident through its parent, a definition without strategy is unsupported and its algorithm is skipped.
EnumSchemaStrategy
Bases: SchemaStrategy[QgsProcessingParameterEnum]
The options as one_of. The value is the option itself when the parameter uses
static strings, otherwise the index of the option, as QGIS expects it.
Source code in src/qgis_server_light/processing/description.py
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 | |
map_schema(definition: QgsProcessingParameterEnum) -> Schema
The schema of the enum, each option an entry of one_of with const and
title.
Raises:
-
ValueError–If the parameter allows multiple options.
Source code in src/qgis_server_light/processing/description.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
FeatureSourceSchemaStrategy
Bases: LayerSchemaStrategy[QgsProcessingParameterFeatureSource | QgsProcessingParameterVectorLayer]
A vector layer, restricted to the geometry types the parameter accepts.
Source code in src/qgis_server_light/processing/description.py
269 270 271 272 273 274 275 276 277 278 279 | |
source_types(definition: QgsProcessingParameterFeatureSource | QgsProcessingParameterVectorLayer) -> list[int]
Source code in src/qgis_server_light/processing/description.py
274 275 276 277 278 279 | |
FileOutputSchemaStrategy
Bases: SchemaStrategy[QgsProcessingOutputDefinition]
An output the worker writes to a file, offered in each of the given media types. The first one is the default.
Source code in src/qgis_server_light/processing/description.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 | |
media_types = media_types
instance-attribute
__init__(media_types: list[str])
Source code in src/qgis_server_light/processing/description.py
316 317 | |
map_schema(definition: QgsProcessingOutputDefinition) -> Schema
Source code in src/qgis_server_light/processing/description.py
319 320 321 322 323 324 325 | |
LayerSchemaStrategy
Bases: SchemaStrategy[D], ABC
A layer value (QslJobLayer), marked with a QslLayerMarker. The marker is derived
from the Qgis.ProcessingSourceType values the definition accepts. Source types QSL
can't serve as layer (mesh, point cloud, vector tile, file, ...) are left out.
Source code in src/qgis_server_light/processing/description.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 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 222 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 | |
geometry_types_by_source_type: dict[Qgis.ProcessingSourceType, list[str]] = {Qgis.ProcessingSourceType.MapLayer: [Qgis.GeometryType.Point.name, Qgis.GeometryType.Line.name, Qgis.GeometryType.Polygon.name, Qgis.GeometryType.Null.name], Qgis.ProcessingSourceType.Vector: [Qgis.GeometryType.Point.name, Qgis.GeometryType.Line.name, Qgis.GeometryType.Polygon.name, Qgis.GeometryType.Null.name], Qgis.ProcessingSourceType.VectorAnyGeometry: [Qgis.GeometryType.Point.name, Qgis.GeometryType.Line.name, Qgis.GeometryType.Polygon.name], Qgis.ProcessingSourceType.VectorPoint: [Qgis.GeometryType.Point.name], Qgis.ProcessingSourceType.VectorLine: [Qgis.GeometryType.Line.name], Qgis.ProcessingSourceType.VectorPolygon: [Qgis.GeometryType.Polygon.name], Qgis.ProcessingSourceType.Raster: []}
class-attribute
instance-attribute
layer_kinds_by_source_type: dict[Qgis.ProcessingSourceType, list[QslLayerKind]] = {Qgis.ProcessingSourceType.MapLayer: [QslLayerKind.VECTOR, QslLayerKind.RASTER], Qgis.ProcessingSourceType.Vector: [QslLayerKind.VECTOR], Qgis.ProcessingSourceType.VectorAnyGeometry: [QslLayerKind.VECTOR], Qgis.ProcessingSourceType.VectorPoint: [QslLayerKind.VECTOR], Qgis.ProcessingSourceType.VectorLine: [QslLayerKind.VECTOR], Qgis.ProcessingSourceType.VectorPolygon: [QslLayerKind.VECTOR], Qgis.ProcessingSourceType.Raster: [QslLayerKind.RASTER]}
class-attribute
instance-attribute
map_schema(definition: D) -> Schema
The schema of a layer value, a string marked with QSL_LAYER_FORMAT and the
kinds and geometry types of all servable source types in the marker.
Raises:
-
ValueError–If none of the source types can be served as layer.
Source code in src/qgis_server_light/processing/description.py
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 | |
source_types(definition: D) -> list[int]
abstractmethod
The Qgis.ProcessingSourceType values the definition accepts.
Parameters:
-
definition(D) –The QGIS parameter or output definition.
Returns:
-
list[int]–The source types as QGIS hands them out, as int.
Source code in src/qgis_server_light/processing/description.py
222 223 224 225 226 227 228 229 230 231 232 | |
LiteralOutputSchemaStrategy
Bases: SchemaStrategy[QgsProcessingOutputDefinition]
An output with a plain JSON Schema type.
Source code in src/qgis_server_light/processing/description.py
103 104 105 106 107 108 109 110 | |
json_type = json_type
instance-attribute
__init__(json_type: str)
Source code in src/qgis_server_light/processing/description.py
106 107 | |
map_schema(definition: QgsProcessingOutputDefinition) -> Schema
Source code in src/qgis_server_light/processing/description.py
109 110 | |
LiteralSchemaStrategy
Bases: SchemaStrategy[QgsProcessingParameterDefinition]
A parameter with a plain JSON Schema type and the QGIS default as default.
Source code in src/qgis_server_light/processing/description.py
93 94 95 96 97 98 99 100 | |
json_type = json_type
instance-attribute
__init__(json_type: str)
Source code in src/qgis_server_light/processing/description.py
96 97 | |
map_schema(definition: QgsProcessingParameterDefinition) -> Schema
Source code in src/qgis_server_light/processing/description.py
99 100 | |
MapLayerSchemaStrategy
Bases: LayerSchemaStrategy[QgsProcessingParameterMapLayer]
Any layer QSL can serve, a vector or a raster layer.
Source code in src/qgis_server_light/processing/description.py
282 283 284 285 286 287 | |
source_types(definition: QgsProcessingParameterMapLayer) -> list[int]
Source code in src/qgis_server_light/processing/description.py
285 286 287 | |
MultipleLayersSchemaStrategy
Bases: LayerSchemaStrategy[QgsProcessingParameterMultipleLayers]
Multiple layers are multiple values of the input, each one layer.
Source code in src/qgis_server_light/processing/description.py
297 298 299 300 301 302 303 304 305 306 307 308 309 | |
occurs(definition: QgsProcessingParameterMultipleLayers, optional: bool) -> tuple[int, int | str]
Source code in src/qgis_server_light/processing/description.py
303 304 305 306 307 308 309 | |
source_types(definition: QgsProcessingParameterMultipleLayers) -> list[int]
Source code in src/qgis_server_light/processing/description.py
300 301 | |
NumberSchemaStrategy
Bases: SchemaStrategy[QgsProcessingParameterNumber]
A number with its bounds, number or integer as QGIS types it.
Source code in src/qgis_server_light/processing/description.py
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 | |
bounds(definition: QgsProcessingParameterNumber) -> tuple[float | None, float | None]
The bounds of the number, None where QGIS sets no bound.
Source code in src/qgis_server_light/processing/description.py
116 117 118 119 120 121 122 | |
map_schema(definition: QgsProcessingParameterNumber) -> Schema
The schema of the number, the bounds QGIS sets are its minimum and maximum.
Raises:
-
ValueError–If the number type is not supported.
Source code in src/qgis_server_light/processing/description.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
ProcessDescriptionMapper
Maps a QGIS processing algorithm onto its process description. The schema of each parameter and output is mapped by the strategy registered for its exact QGIS class, definitions without a strategy are not supported.
Source code in src/qgis_server_light/processing/description.py
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 | |
__init__() -> None
Source code in src/qgis_server_light/processing/description.py
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 | |
input_description(param: QgsProcessingParameterDefinition) -> InputDescription
The description of a parameter as input, an optional one needs no value.
Raises:
-
ValueError–If the parameter type is not supported.
Source code in src/qgis_server_light/processing/description.py
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | |
output_description(output: QgsProcessingOutputDefinition) -> OutputDescription
The description of an output, a file output with the formats it is offered in.
Raises:
-
ValueError–If the output type is not supported.
Source code in src/qgis_server_light/processing/description.py
398 399 400 401 402 403 404 405 406 407 408 409 410 411 | |
process_description(algorithm: QgsProcessingAlgorithm) -> ProcessDescription
The description of the algorithm as process. Destination parameters are no inputs, the worker sets them.
Source code in src/qgis_server_light/processing/description.py
363 364 365 366 367 368 369 370 371 372 373 374 375 376 | |
RasterLayerSchemaStrategy
Bases: LayerSchemaStrategy[QgsProcessingParameterRasterLayer]
A raster layer.
Source code in src/qgis_server_light/processing/description.py
290 291 292 293 294 | |
source_types(definition: QgsProcessingParameterRasterLayer) -> list[int]
Source code in src/qgis_server_light/processing/description.py
293 294 | |
SchemaStrategy
Bases: ABC
Maps one kind of QGIS parameter or output definition onto the schema of its value.
D is the QGIS definition class the strategy handles.
Source code in src/qgis_server_light/processing/description.py
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 | |
default(definition: QgsProcessingParameterDefinition)
staticmethod
The default of the parameter, None if it has none.
Source code in src/qgis_server_light/processing/description.py
83 84 85 86 87 88 89 90 | |
map_schema(definition: D) -> Schema
abstractmethod
The schema of a single value of the parameter or output.
Parameters:
-
definition(D) –The QGIS parameter or output definition.
Returns:
-
Schema–The schema of the value.
Source code in src/qgis_server_light/processing/description.py
59 60 61 62 63 64 65 66 67 68 69 | |
occurs(definition: D, optional: bool) -> tuple[int, int | str]
The minimal and maximal number of values of an input.
Parameters:
-
definition(D) –The QGIS parameter definition.
-
optional(bool) –If the parameter is optional.
Returns:
-
tuple[int, int | str]–The minimal and the maximal number, a single value by default.
Source code in src/qgis_server_light/processing/description.py
71 72 73 74 75 76 77 78 79 80 81 | |
worker
engine
Engine
Bases: ABC
Source code in src/qgis_server_light/worker/engine.py
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 | |
available_job_info_classes: dict[str, type[QslJobInfoParameter]] = {}
instance-attribute
available_runner_classes: dict[str, type[Runner]] = {}
instance-attribute
available_runner_classes_by_job_info: dict[str, type[Runner]] = {}
instance-attribute
context = context
instance-attribute
info = self._initialize_infos()
instance-attribute
layer_cache = LayerCache()
instance-attribute
qgis = Qgis(svg_paths, log_level)
instance-attribute
status
property
__del__()
Source code in src/qgis_server_light/worker/engine.py
51 52 | |
__init__(context: EngineContext, runner_plugins: list[str], svg_paths: list[str] | None = None, log_level=logging.WARNING)
Source code in src/qgis_server_light/worker/engine.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
process(job_info: QslJobInfoParameter, feedback: QgsProcessingFeedback | None = None) -> JobResult
Hands the job to the runner which is responsible for it.
Every runner gets its own copy of the context, so a runner can't change what the next job sees.
Parameters:
-
job_info(QslJobInfoParameter) –The job to solve.
-
feedback(QgsProcessingFeedback | None, default:None) –The feedback the job reports its progress to and is canceled through,
Noneif nobody listens.
Returns:
-
JobResult–The result the runner produced.
Source code in src/qgis_server_light/worker/engine.py
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 | |
runner_plugin_by_job_info(job_info: QslJobInfoParameter) -> type[Runner]
Here we decide which plugin we load dynamically out of the available ones.
Parameters:
-
job_info(QslJobInfoParameter) –Is the parameter instance we check the available worker classes and there the job_info_class at each.
Returns:
-
type[Runner]–The selected runner class
Source code in src/qgis_server_light/worker/engine.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
set_crashed()
Source code in src/qgis_server_light/worker/engine.py
158 159 | |
set_processing()
Source code in src/qgis_server_light/worker/engine.py
161 162 | |
set_waiting()
Source code in src/qgis_server_light/worker/engine.py
155 156 | |
EngineContext
dataclass
Bases: JobContext
The engine hands its context on to every job, so it carries exactly the
attributes of JobContext. A new attribute is therefore added in one place only.
Source code in src/qgis_server_light/worker/engine.py
24 25 26 27 28 | |
__init__(base_path: str | Path, process_allowlist: list[str] = list(), process_output_dir: str | Path | None = None, process_internal_allowlist: list[str] = list(), process_timeout: float | None = None, process_max_output_size: int | None = None, process_max_features: int | None = None, feedback: QgsProcessingFeedback | None = None) -> None
image_utils
job_guard
JobDismissedError
Bases: Exception
The job was dismissed while it ran.
Source code in src/qgis_server_light/worker/job_guard.py
11 12 | |
JobGuard
Watches a running process job from its own thread, the algorithm blocks the
thread of the worker. Once the job is dismissed, runs longer than timeout or its
outputs grow beyond max_output_size, the guard cancels the feedback of the job.
QGIS algorithms check it and stop. Native code which doesn't check it would keep the
worker busy forever, so if the job doesn't stop within cancel_grace the guard
abandons it and ends the worker process the hard way, its restart brings it back.
Used as context manager around the job, it hands out the feedback the job runs with and turns the error of a job it canceled into the reason it canceled it.
Attributes:
-
check_interval(float) –Seconds between two looks at the job.
-
cancel_grace(float) –Seconds a canceled job has to stop before the worker exits.
Source code in src/qgis_server_light/worker/job_guard.py
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 | |
abandon = abandon
instance-attribute
cancel_grace: float = 30.0
class-attribute
instance-attribute
check_interval: float = 1.0
class-attribute
instance-attribute
dismissed = dismissed
instance-attribute
feedback = feedback
instance-attribute
finished = threading.Event()
instance-attribute
max_output_size = max_output_size
instance-attribute
output_dir = output_dir
instance-attribute
reason: Exception | None = None
instance-attribute
thread = threading.Thread(target=(self.watch), name='job-guard', daemon=True)
instance-attribute
timeout = timeout
instance-attribute
__enter__() -> QgsProcessingFeedback
Starts the clock of the timeout and the watch.
Returns:
-
QgsProcessingFeedback–The feedback the job has to run with, it is the line the guard pulls on.
Source code in src/qgis_server_light/worker/job_guard.py
68 69 70 71 72 73 74 75 76 | |
__exit__(exc_type, exc, traceback)
Stops the watch once the job is over, however it ended. The error of a job the guard canceled tells little more than "canceled", so it is replaced by the reason, the original stays attached as cause.
Raises:
-
JobDismissedError–If the guard canceled the job because it was dismissed.
-
JobLimitExceededError–If the guard canceled the job because of a limit.
Source code in src/qgis_server_light/worker/job_guard.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
__init__(feedback: QgsProcessingFeedback, dismissed: Callable[[], bool], abandon: Callable[[Exception], None], timeout: float | None = None, output_dir: Path | None = None, max_output_size: int | None = None)
Parameters:
-
feedback(QgsProcessingFeedback) –The feedback the job runs with.
-
dismissed(Callable[[], bool]) –Tells if somebody dismissed the job.
-
abandon(Callable[[Exception], None]) –Finishes the job for good before the worker exits, it gets the reason the job was canceled for.
-
timeout(float | None, default:None) –Seconds the job may run,
Nonefor no limit. -
output_dir(Path | None, default:None) –The dir the job writes its outputs to.
-
max_output_size(int | None, default:None) –Bytes the job may write into
output_dir,Nonefor no limit.
Source code in src/qgis_server_light/worker/job_guard.py
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 | |
check() -> Exception | None
Looks at the job once.
Returns:
-
Exception | None–The reason to cancel the job,
Noneif it may go on.
Source code in src/qgis_server_light/worker/job_guard.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
output_size() -> int
The bytes the job has written so far.
Source code in src/qgis_server_light/worker/job_guard.py
137 138 139 140 141 142 143 144 145 146 147 148 149 | |
watch()
The loop of the guard thread: it looks at the job every check_interval
seconds until the job is over or there is a reason to cancel it. After the cancel
it gives the job cancel_grace seconds to stop, a job ignoring it is abandoned
together with the worker process.
Source code in src/qgis_server_light/worker/job_guard.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | |
JobLimitExceededError
Bases: Exception
The job ran too long or wrote too much.
Source code in src/qgis_server_light/worker/job_guard.py
15 16 | |
layer_cache
DEFAULT_TTL_SECONDS = 24 * 60 * 60
module-attribute
LayerCache
Bases: MutableMapping[str, QgsMapLayer]
Layers opened by the worker, shared by all jobs of the worker process.
Entries which were not used for longer than the TTL are evicted by
evict_expired. This bounds the growth caused by layers which are not
requested anymore (e.g. after a project was changed). It does not bound the
number of layers used within one TTL.
Not thread safe: only the thread processing the jobs may access it.
Source code in src/qgis_server_light/worker/layer_cache.py
10 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 | |
ttl_seconds = ttl_seconds
instance-attribute
__contains__(cache_name: object) -> bool
Source code in src/qgis_server_light/worker/layer_cache.py
39 40 | |
__delitem__(cache_name: str) -> None
Source code in src/qgis_server_light/worker/layer_cache.py
35 36 37 | |
__getitem__(cache_name: str) -> QgsMapLayer
Source code in src/qgis_server_light/worker/layer_cache.py
26 27 28 29 | |
__init__(ttl_seconds: float = DEFAULT_TTL_SECONDS) -> None
Source code in src/qgis_server_light/worker/layer_cache.py
21 22 23 24 | |
__iter__() -> Iterator[str]
Source code in src/qgis_server_light/worker/layer_cache.py
42 43 | |
__len__() -> int
Source code in src/qgis_server_light/worker/layer_cache.py
45 46 | |
__setitem__(cache_name: str, layer: QgsMapLayer) -> None
Source code in src/qgis_server_light/worker/layer_cache.py
31 32 33 | |
evict_expired() -> int
Evicts all layers which were not used within the TTL.
Returns:
-
int–The number of evicted layers.
Source code in src/qgis_server_light/worker/layer_cache.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
qgis
CredentialsHelper
Bases: QgsCredentials
Source code in src/qgis_server_light/worker/qgis.py
8 9 10 11 12 13 14 15 16 17 18 | |
__init__()
Source code in src/qgis_server_light/worker/qgis.py
9 10 11 | |
request(realm, username, password, message)
Source code in src/qgis_server_light/worker/qgis.py
13 14 15 | |
requestMasterPassword(password, stored)
Source code in src/qgis_server_light/worker/qgis.py
17 18 | |
Qgis(svg_paths: list[str] | None, log_level)
Source code in src/qgis_server_light/worker/qgis.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
version() -> int
Source code in src/qgis_server_light/worker/qgis.py
46 47 | |
version_name() -> str
Source code in src/qgis_server_light/worker/qgis.py
50 51 | |
qgis_type_serializer
QDateConverter
Bases: Converter
Source code in src/qgis_server_light/worker/qgis_type_serializer.py
9 10 11 12 13 14 15 16 17 18 19 | |
format = 'yyyy-MM-dd'
class-attribute
instance-attribute
deserialize(value: str, **kwargs: Any) -> QDate
Source code in src/qgis_server_light/worker/qgis_type_serializer.py
12 13 | |
serialize(value: QDate, **kwargs: Any) -> str | None
Source code in src/qgis_server_light/worker/qgis_type_serializer.py
15 16 17 18 19 | |
QDateTimeConverter
Bases: Converter
Source code in src/qgis_server_light/worker/qgis_type_serializer.py
22 23 24 25 26 27 28 29 30 31 32 | |
format = Qt.DateFormat.ISODate
class-attribute
instance-attribute
deserialize(value: str, **kwargs: Any) -> QDateTime
Source code in src/qgis_server_light/worker/qgis_type_serializer.py
25 26 | |
serialize(value: QDateTime, **kwargs: Any) -> str | None
Source code in src/qgis_server_light/worker/qgis_type_serializer.py
28 29 30 31 32 | |
register_converters_at_runtime()
Source code in src/qgis_server_light/worker/qgis_type_serializer.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |
redis
DEFAULT_DATA_ROOT = '/io/data'
module-attribute
DEFAULT_PROCESS_ALLOWLIST = ','.join(['native:buffer', 'native:centroids'])
module-attribute
DEFAULT_PROCESS_MAX_FEATURES = 1000000
module-attribute
DEFAULT_PROCESS_MAX_OUTPUT_SIZE = 1024
module-attribute
DEFAULT_PROCESS_OUTPUT_DIR = '/io/process_output'
module-attribute
DEFAULT_PROCESS_TIMEOUT = 3600
module-attribute
DEFAULT_RUNNER_PLUGINS = ':'.join(['qgis_server_light.worker.runner.render.RenderRunner', 'qgis_server_light.worker.runner.legend.GetLegendRunner', 'qgis_server_light.worker.runner.feature.GetFeatureRunner', 'qgis_server_light.worker.runner.crs.CrsRunner'])
module-attribute
DEFAULT_SVG_PATH = '/io/svg'
module-attribute
engine_classes: dict[str, type[RedisEngine]] = {'publish': RedisPublishEngine, 'state': RedisStateEngine}
module-attribute
JobProgress
Writes the progress a running job reports into its job hash. QGIS reports the progress per feature as float, so only a change of the full percentage is written, that's at most 101 writes per job.
Source code in src/qgis_server_light/worker/redis.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
client = client
instance-attribute
job_key = job_key
instance-attribute
percent: int | None = None
instance-attribute
progress_key = progress_key
instance-attribute
__call__(progress: float)
Source code in src/qgis_server_light/worker/redis.py
73 74 75 76 77 78 79 80 | |
__init__(client: Redis, job_key: str, progress_key: str)
Source code in src/qgis_server_light/worker/redis.py
67 68 69 70 71 | |
RedisEngine
Bases: Engine
The common part of the redis workers: connecting, registering, the heartbeat and the loop taking jobs from the queue. How a finished job is delivered is decided by the subclasses, so the loop does not need to know about it.
Attributes:
-
protocol(type[RedisProtocol]) –The protocol the engine is built on, it defines the queue the engine listens on.
Source code in src/qgis_server_light/worker/redis.py
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 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 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 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 | |
boot_start = time.time()
instance-attribute
heartbeat_interval = RedisProtocol.worker_heartbeat_interval
instance-attribute
heartbeat_thread = None
instance-attribute
info_expire: int = 300
instance-attribute
max_retries = 11
instance-attribute
once = once
instance-attribute
processes_json: str | None = None
instance-attribute
protocol: type[RedisProtocol]
instance-attribute
queue_name = self.protocol.queue_name()
instance-attribute
redis_client: Redis | None = None
instance-attribute
retry_wait = 0.01
instance-attribute
shutdown = False
instance-attribute
__init__(context: EngineContext, runner_plugins: list[str], svg_paths: list | None = None, once: bool = False) -> None
Source code in src/qgis_server_light/worker/redis.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
describe_processes()
Describes the processes the worker serves once on boot, the beats only pass the result on. Workers without the process runner don't serve processes and describe nothing.
Source code in src/qgis_server_light/worker/redis.py
237 238 239 240 241 242 243 244 245 246 247 248 249 | |
exit_connection_error()
staticmethod
Source code in src/qgis_server_light/worker/redis.py
126 127 128 129 | |
exit_gracefully(signum, frame)
Source code in src/qgis_server_light/worker/redis.py
131 132 133 134 135 136 | |
fail_job(job_id: str, job_info: QslJobInfoParameter | None, error: Exception, pipeline: Pipeline, start_time: float)
abstractmethod
Delivers the error of a job which failed, or was dismissed while it ran.
Parameters:
-
job_id(str) –The unique identifier of the job.
-
job_info(QslJobInfoParameter | None) –The job info of the job,
Noneif it failed before the job info could be read. -
error(Exception) –The error the job failed with.
-
pipeline(Pipeline) –The pipeline holding the transaction.
-
start_time(float) –The time the job was taken from the queue.
Source code in src/qgis_server_light/worker/redis.py
464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | |
heartbeat(client: Redis) -> datetime.datetime
Tells redis that this worker is still alive. Each beat is the full advertisement: the worker info with its current status, the last seen timestamp, the renewed expiry and the id in the list of workers. The beat does not ask redis what it still knows, it simply writes everything again. So when redis lost its keys (restart, flush, eviction) the worker is back within one heartbeat interval, without anybody having to notice the loss. Only the process descriptions are too big for that, the beat asks for them and writes them when they are missing.
Parameters:
-
client(Redis) –The redis client.
Returns:
-
datetime–The UTC timestamp which was written as last seen.
Source code in src/qgis_server_light/worker/redis.py
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 | |
job_guard(client: Redis, job_id: str, job_info: QslJobInfoParameter, start_time: float) -> AbstractContextManager[QgsProcessingFeedback | None]
What watches the job while it runs, it hands out the feedback the job reports its progress to and is canceled through.
Parameters:
-
client(Redis) –The redis client.
-
job_id(str) –The unique identifier of the job.
-
job_info(QslJobInfoParameter) –The job info of the job.
-
start_time(float) –The time the job was taken from the queue.
Returns:
-
AbstractContextManager[QgsProcessingFeedback | None]–The context manager around the job, giving the feedback,
Noneif nobody -
AbstractContextManager[QgsProcessingFeedback | None]–listens.
Source code in src/qgis_server_light/worker/redis.py
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 | |
prune_vanished_workers(client: Redis)
staticmethod
Removes the ids of workers from the list whose hash expired already. Such a worker was killed or lost its container and could not say goodbye, so a starting colleague tidies up behind it.
Parameters:
-
client(Redis) –The redis client.
Source code in src/qgis_server_light/worker/redis.py
205 206 207 208 209 210 211 212 213 214 215 216 217 218 | |
register_worker(client: Redis)
Makes this worker known in redis and cleans up behind workers which vanished without unregistering. This way the list of workers heals itself with every worker start. The advertising itself is left to the first beat, there is only one place which knows what a worker writes.
Parameters:
-
client(Redis) –The redis client.
Source code in src/qgis_server_light/worker/redis.py
191 192 193 194 195 196 197 198 199 200 201 202 203 | |
report_crash(client: Redis)
Sets the status to crashed and tells redis right away. When redis is part of the trouble, the worker only logs that it couldn't report, the original error is the one which matters and must not be covered by a redis one.
Parameters:
-
client(Redis) –The redis client.
Source code in src/qgis_server_light/worker/redis.py
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | |
retry_connection(redis_url: str, count: int)
Source code in src/qgis_server_light/worker/redis.py
267 268 269 | |
retry_handling_with_jitter(count: int)
Source code in src/qgis_server_light/worker/redis.py
118 119 120 121 122 123 124 | |
run(redis_url)
Connects to redis, registers the worker, starts the heartbeat and serves jobs
until the worker is told to stop, or with once until it served one. If
something unexpected breaks the job loop, the worker reports its crash to redis
before it goes down with the very same error, so the logs still show what
happened. Exiting on purpose (a signal or giving up on redis) is not a crash.
Parameters:
-
redis_url–The url of redis, e.g.
redis://qsl-redis:6379.
Source code in src/qgis_server_light/worker/redis.py
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 | |
serve_jobs(r: Redis, p: Pipeline, redis_url: str)
The job loop: takes the next job from the queue, processes it and publishes
the result. A failing job is published as an error result, the loop goes on. A
dismissed job is delivered the same way, but only noted in the log, somebody
asked for it. With once the loop ends after the first job. When the connection
to redis is lost, the loop waits for it to come back and carries on, the
heartbeat thread takes care of advertising the worker again.
Parameters:
-
r(Redis) –The redis client.
-
p(Pipeline) –The pipeline the job status and the result are written with.
-
redis_url(str) –The url of redis, used when waiting for the connection.
Source code in src/qgis_server_light/worker/redis.py
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 | |
set_job_runtime_status(job_id: str, pipeline: Pipeline, status: str, start_time: float)
staticmethod
Source code in src/qgis_server_light/worker/redis.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | |
start(redis_url) -> Redis
Source code in src/qgis_server_light/worker/redis.py
271 272 273 274 275 276 | |
start_heartbeat_worker(client: Redis)
Creates an own thread which is responsible for renewing the heartbeat info of the worker in redis
Source code in src/qgis_server_light/worker/redis.py
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | |
succeed_job(job_id: str, job_info: QslJobInfoParameter, result: JobResult, pipeline: Pipeline, start_time: float)
abstractmethod
Delivers the result of a job which was solved.
Parameters:
-
job_id(str) –The unique identifier of the job.
-
job_info(QslJobInfoParameter) –The job info of the job.
-
result(JobResult) –The result the runner returned.
-
pipeline(Pipeline) –The pipeline holding the transaction.
-
start_time(float) –The time the job was taken from the queue.
Source code in src/qgis_server_light/worker/redis.py
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | |
unregister_worker(client: Redis)
Removes this worker from redis on a graceful shutdown. If redis is gone already, the worker does not insist: its info expires and the next registering worker cleans the list.
Parameters:
-
client(Redis) –The redis client.
Source code in src/qgis_server_light/worker/redis.py
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | |
wait_for_connection(client: Redis, redis_url: str)
Pings redis until it answers, waiting a bit longer after each refused ping. It is used on start and whenever the job loop lost the connection. Each outage gets the full number of retries, a worker which survived many short hiccups should not give up on the next one just because it used them up already.
Parameters:
-
client(Redis) –The redis client.
-
redis_url(str) –The url of redis, only used to tell in the logs where the worker is knocking.
Source code in src/qgis_server_light/worker/redis.py
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 | |
write_missing_processes(client: Redis)
Writes the process descriptions into the hash of the worker when they are not there. The descriptions are too big to be written with every beat, so the beat only asks whether redis still knows them. After redis lost its keys they are back within one heartbeat interval like the rest of the worker.
Parameters:
-
client(Redis) –The redis client.
Source code in src/qgis_server_light/worker/redis.py
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | |
RedisPublishEngine
Bases: RedisEngine
The engine publishing the result to the waiting dispatcher (see
RedisPublishProtocol). This is the default, map related jobs are served
by it.
Source code in src/qgis_server_light/worker/redis.py
486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 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 | |
protocol = RedisPublishProtocol
class-attribute
instance-attribute
fail_job(job_id: str, job_info: QslJobInfoParameter | None, error: Exception, pipeline: Pipeline, start_time: float)
Source code in src/qgis_server_light/worker/redis.py
527 528 529 530 531 532 533 534 535 536 537 | |
publish_result(job_id: str, result: JobResult, pipeline: Pipeline, status: str, start_time: float)
Sets the final status and publishes the pickled result. Success and failure only differ in the result and the status, so both end here.
Parameters:
-
job_id(str) –The unique identifier of the job.
-
result(JobResult) –The result to publish, the worker information is added.
-
pipeline(Pipeline) –The pipeline holding the transaction.
-
status(str) –The final status of the job.
-
start_time(float) –The time the job was taken from the queue.
Source code in src/qgis_server_light/worker/redis.py
494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 | |
succeed_job(job_id: str, job_info: QslJobInfoParameter, result: JobResult, pipeline: Pipeline, start_time: float)
Source code in src/qgis_server_light/worker/redis.py
517 518 519 520 521 522 523 524 525 | |
RedisStateEngine
Bases: RedisEngine
The engine keeping the result in the job hash (see RedisStateProtocol).
Process-workers are started with it.
Source code in src/qgis_server_light/worker/redis.py
540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 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 607 608 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 | |
protocol = RedisStateProtocol
class-attribute
instance-attribute
abandon_job(client: Redis, job_id: str, job_info: QslJobInfoParameter, reason: Exception, start_time: float)
Finishes a job which didn't stop after it was canceled, right before the worker exits. It runs in the thread of the guard, the thread of the worker is still stuck in the algorithm, so it has its own pipeline.
Parameters:
-
client(Redis) –The redis client.
-
job_id(str) –The unique identifier of the job.
-
job_info(QslJobInfoParameter) –The job info of the job.
-
reason(Exception) –Why the job was canceled.
-
start_time(float) –The time the job was taken from the queue.
Source code in src/qgis_server_light/worker/redis.py
595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 | |
fail_job(job_id: str, job_info: QslJobInfoParameter | None, error: Exception, pipeline: Pipeline, start_time: float)
Source code in src/qgis_server_light/worker/redis.py
637 638 639 640 641 642 643 644 645 646 647 | |
finish_job(job_id: str, job_info: QslJobInfoParameter | None, pipeline: Pipeline, status: str, start_time: float)
Renews the expiry, sets the final status and notifies a waiting dispatcher. Success and failure only differ in the fields written before, so both end here.
Parameters:
-
job_id(str) –The unique identifier of the job.
-
job_info(QslJobInfoParameter | None) –The job info of the job,
Noneif it could not be read. A waiting dispatcher can not be ruled out then, so it is notified. -
pipeline(Pipeline) –The pipeline holding the transaction.
-
status(str) –The final status of the job.
-
start_time(float) –The time the job was taken from the queue.
Source code in src/qgis_server_light/worker/redis.py
547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 | |
job_guard(client: Redis, job_id: str, job_info: QslJobInfoParameter, start_time: float) -> JobGuard
Source code in src/qgis_server_light/worker/redis.py
576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 | |
succeed_job(job_id: str, job_info: QslJobInfoParameter, result: JobResult, pipeline: Pipeline, start_time: float)
Source code in src/qgis_server_light/worker/redis.py
621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 | |
main() -> None
Source code in src/qgis_server_light/worker/redis.py
656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 | |
runner
common
ImageRunner
Bases: MapRunner
Base class for any map runner which answers with an encoded image. Not runnable by itself.
Source code in src/qgis_server_light/worker/runner/common.py
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 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 | |
image_formats()
classmethod
Source code in src/qgis_server_light/worker/runner/common.py
490 491 492 | |
JobContext
dataclass
What a runner needs to know about the worker it runs on. The engine hands each job its own copy.
Attributes:
-
base_path(str | Path) –The absolute path to the data dir.
-
process_allowlist(list[str]) –The ids of the QGIS algorithms the worker serves as processes.
-
process_output_dir(str | Path | None) –The absolute path to the dir the processes write their outputs to, each job into its own sub dir. Only the process runner needs it, it refuses to run without.
-
process_internal_allowlist(list[str]) –The ids of the QGIS algorithms the worker serves as processes for internal use of the consumer only, they must not be published.
-
process_timeout(float | None) –Seconds a process job may run,
Nonefor no limit. -
process_max_output_size(int | None) –Bytes a process job may write,
Nonefor no limit. -
process_max_features(int | None) –Features a vector layer input of a process may have,
Nonefor no limit. -
feedback(QgsProcessingFeedback | None) –The feedback a process job runs with, the engine reads the progress from it and cancels the job through it. It is set by the engine per job,
Noneif nobody listens.
Source code in src/qgis_server_light/worker/runner/common.py
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 | |
base_path: str | Path
instance-attribute
feedback: QgsProcessingFeedback | None = None
class-attribute
instance-attribute
process_allowlist: list[str] = field(default_factory=list)
class-attribute
instance-attribute
process_internal_allowlist: list[str] = field(default_factory=list)
class-attribute
instance-attribute
process_max_features: int | None = None
class-attribute
instance-attribute
process_max_output_size: int | None = None
class-attribute
instance-attribute
process_output_dir: str | Path | None = None
class-attribute
instance-attribute
process_timeout: float | None = None
class-attribute
instance-attribute
served_process_ids: list[str]
property
The ids of all algorithms the worker serves, published or internal.
__init__(base_path: str | Path, process_allowlist: list[str] = list(), process_output_dir: str | Path | None = None, process_internal_allowlist: list[str] = list(), process_timeout: float | None = None, process_max_output_size: int | None = None, process_max_features: int | None = None, feedback: QgsProcessingFeedback | None = None) -> None
MapRunner
Bases: Runner
Base class for any runner that interacts with a map. Not runnable by itself.
Source code in src/qgis_server_light/worker/runner/common.py
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 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 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 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 | |
context = context
instance-attribute
custom_layer_drivers = ['xyzvectortiles', 'mbtilesvectortiles']
class-attribute
instance-attribute
default_style_name = 'default'
class-attribute
instance-attribute
job_info = job_info
instance-attribute
layer_cache = layer_cache
instance-attribute
map_layers: list[QgsMapLayer] = list()
instance-attribute
qgis = qgis
instance-attribute
raster_layer_drivers = ['gdal', 'wms', 'xyz', 'arcgismapserver', 'wcs']
class-attribute
instance-attribute
vector_layer_drivers = ['ogr', 'postgres', 'spatialite', 'mssql', 'oracle', 'wfs', 'delimitedtext', 'gpx', 'arcgisfeatureserver']
class-attribute
instance-attribute
__init__(qgis: QgsApplication, context: JobContext, job_info: QslJobInfoParameter, layer_cache: MutableMapping | None = None) -> None
Source code in src/qgis_server_light/worker/runner/common.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
get_cache_name(job_layer_definition: QslJobLayer) -> str
Central method to decide which name is used in the cache to identify a layer.
Source code in src/qgis_server_light/worker/runner/common.py
251 252 253 254 255 256 257 258 259 260 261 262 | |
Runner
Bases: ABC
Source code in src/qgis_server_light/worker/runner/common.py
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 | |
job_info_class: type[QslJobInfoParameter]
instance-attribute
__init__(qgis: QgsApplication, context: JobContext, job_info: QslJobInfoParameter, layer_cache: MutableMapping | None)
Source code in src/qgis_server_light/worker/runner/common.py
80 81 82 83 84 85 86 87 88 | |
deserialize_job_info(job_info: bytes)
classmethod
Source code in src/qgis_server_light/worker/runner/common.py
104 105 106 | |
prepare(qgis: QgsApplication) -> None
classmethod
Sets up what the runner needs from QGIS before it gets its first job. The engine calls it once per runner it boots with, so a worker only pays for the runners it actually serves. Most runners need nothing.
Parameters:
-
qgis(QgsApplication) –The QGIS application of the worker.
Source code in src/qgis_server_light/worker/runner/common.py
94 95 96 97 98 99 100 101 102 | |
run()
Source code in src/qgis_server_light/worker/runner/common.py
90 91 92 | |
crs
CrsRunner
Bases: Runner
Resolves crs identifiers, it needs neither a map nor layers.
Source code in src/qgis_server_light/worker/runner/crs.py
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 | |
context = context
instance-attribute
job_info = job_info
instance-attribute
job_info_class = QslJobInfoCrs
class-attribute
instance-attribute
qgis = qgis
instance-attribute
__init__(qgis: QgsApplication, context: JobContext, job_info: QslJobInfoCrs, layer_cache: MutableMapping | None = None) -> None
Source code in src/qgis_server_light/worker/runner/crs.py
19 20 21 22 23 24 25 26 27 28 | |
run()
Source code in src/qgis_server_light/worker/runner/crs.py
30 31 32 33 34 35 36 37 38 39 40 41 42 | |
feature
GetFeatureRunner
Bases: MapRunner
Source code in src/qgis_server_light/worker/runner/feature.py
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 | |
job_info_class = QslJobInfoFeature
class-attribute
instance-attribute
__init__(qgis: QgsApplication, context: JobContext, job_info: QslJobInfoFeature, layer_cache: MutableMapping | None = None, layer_style_cache: set | None = None) -> None
Source code in src/qgis_server_light/worker/runner/feature.py
37 38 39 40 41 42 43 44 45 | |
run()
Source code in src/qgis_server_light/worker/runner/feature.py
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 | |
feature_info
GetFeatureInfoRunner
Bases: MapRunner
Source code in src/qgis_server_light/worker/runner/feature_info.py
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 | |
job_info_class = QslJobInfoFeatureInfo
class-attribute
instance-attribute
__init__(qgis: QgsApplication, context: JobContext, job_info: QslJobInfoFeatureInfo, layer_cache: MutableMapping | None = None) -> None
Source code in src/qgis_server_light/worker/runner/feature_info.py
23 24 25 26 27 28 29 30 | |
run()
Source code in src/qgis_server_light/worker/runner/feature_info.py
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 | |
legend
GetLegendRunner
Bases: ImageRunner
Source code in src/qgis_server_light/worker/runner/legend.py
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 | |
job_info_class = QslJobInfoLegend
class-attribute
instance-attribute
__init__(qgis: QgsApplication, context: JobContext, job_info: QslJobInfoLegend, layer_cache: MutableMapping | None = None) -> None
Source code in src/qgis_server_light/worker/runner/legend.py
24 25 26 27 28 29 30 31 | |
json_formats()
classmethod
Source code in src/qgis_server_light/worker/runner/legend.py
33 34 35 | |
run()
Source code in src/qgis_server_light/worker/runner/legend.py
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 | |
process
ProcessRunner
Bases: MapRunner
Responsible for executing a QGIS processing algorithm as a process.
The runner decides on its own where the outputs go, the client only sends the inputs. This way concurrent jobs never write into the same file and a client can't make the worker write anywhere on its file system.
The format of a file output is chosen by the client among the media types
the process description offers for it, without a choice the first offered
one is used. Vector layers default to GeoJSON, because it takes any data:
a GeoPackage takes an input attribute fid as its feature id and fails if
the values are not unique, FlatGeobuf refuses features without geometry
because of its spatial index.
Attributes:
-
extension_by_media_type–The file extension a destination gets for the media type of its output.
-
media_type_by_extension–The media type of a destination file, by its extension.
Source code in src/qgis_server_light/worker/runner/process.py
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 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 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 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 | |
extension_by_media_type = {'application/geo+json': 'geojson', 'application/geopackage+sqlite3': 'gpkg', 'application/flatgeobuf': 'fgb', 'image/tiff; application=geotiff': 'tif', 'text/html': 'html'}
class-attribute
instance-attribute
job_info_class = QslJobInfoExecuteProcess
class-attribute
instance-attribute
media_type_by_extension = {'geojson': 'application/geo+json', 'gpkg': 'application/geopackage+sqlite3', 'fgb': 'application/flatgeobuf', 'tif': 'image/tiff; application=geotiff', 'html': 'text/html'}
class-attribute
instance-attribute
registry = self.qgis.processingRegistry()
instance-attribute
__init__(qgis: QgsApplication, context: JobContext, job_info: QslJobInfoExecuteProcess, layer_cache: MutableMapping | None = None)
Source code in src/qgis_server_light/worker/runner/process.py
73 74 75 76 77 78 79 80 81 | |
info(qgis: QgsApplication, context: JobContext) -> ProcessDescriptions
classmethod
The descriptions of the processes the worker serves. An algorithm of the allowlist the worker can't serve is skipped and logged, so one entry can't empty the processes of the worker. That's the case for a parameter without mapping and for an algorithm requiring a project, the context of the runner has none.
Parameters:
-
qgis(QgsApplication) –The QGIS application holding the processing registry.
-
context(JobContext) –The context holding the allowlists, the descriptions of the internal ones are marked
internal.
Returns:
-
ProcessDescriptions–The descriptions of the processes the worker serves.
Raises:
-
LookupError–If an algorithm of the allowlist is not in the processing registry.
Source code in src/qgis_server_light/worker/runner/process.py
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 | |
prepare(qgis: QgsApplication) -> None
classmethod
Adds the native: algorithms the processes are served from. A bare
QgsApplication knows no algorithms, and only a process-worker needs them.
Parameters:
-
qgis(QgsApplication) –The QGIS application of the worker.
Source code in src/qgis_server_light/worker/runner/process.py
83 84 85 86 87 88 89 90 91 92 93 94 95 | |
requires_project(algorithm: QgsProcessingAlgorithm) -> bool
staticmethod
If the algorithm needs a project, the processing context of the runner has none.
Source code in src/qgis_server_light/worker/runner/process.py
137 138 139 140 | |
run()
Run this runner.
Every job writes into its own dir {process_output_dir}/{job_id}. If the
job fails or is canceled, the dir is removed again, so only successful jobs
leave files behind.
Returns:
-
–
A JobResult with the ProcessResult as JSON.
Raises:
-
RuntimeError–If the algorithm is not served by this worker, is not found, requires a project or no process output dir is configured.
Source code in src/qgis_server_light/worker/runner/process.py
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 | |
render
RenderRunner
Bases: ImageRunner
Responsible for rendering a QslRenderJob to an image.
Source code in src/qgis_server_light/worker/runner/render.py
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 | |
job_info_class = QslJobInfoRender
class-attribute
instance-attribute
__init__(qgis: QgsApplication, context: JobContext, job_info: QslJobInfoRender, layer_cache: MutableMapping | None = None) -> None
Source code in src/qgis_server_light/worker/runner/render.py
18 19 20 21 22 23 24 25 | |
run()
Run this runner. Returns: A JobResult with the content_type and image_data (bytes) of the rendered image.
Source code in src/qgis_server_light/worker/runner/render.py
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 | |