Pipeline
The pipeline runs steps in the order supplied. To use the footprint processing
functions before generating seamlines, include them after the raster matching
steps:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | |
Postprocessing requires a suitable projected CRS. Tune distances in that CRS's linear units for your imagery; the example values are starting points for the WorldView example. Postprocessing is opt-in. The default workflow still creates footprints automatically when Voronoi has no polygon input.
Footprint paths and layer names pass automatically from creation to postprocessing
and then to either seamline method. Explicit *_input_polygons and *_input_layer
options override these inputs. When supplying an external polygon path without a
layer name, the source's default layer is used. Set the same *_image_field_name
for footprint creation and the selected seamline method when using a custom field.
Replace voronoi_center_seamline with weighted_seamline and supply
weighted_seamline_rank_function to use ranked seamlines. Fields referenced by the
expression must exist in the input polygons; postprocessing preserves them. Existing
polygons can enter through postprocess_footprints_input_polygons or the chosen
seamline step's *_input_polygons option.
Each footprint step can also be the final step, in which case
shared_output_image_path is its output .gpkg file. Intermediate footprint
outputs appear in the result dictionary under create_footprints and
postprocess_footprints. Both steps use the shared worker, backend, debugging,
resume, and temporary-output cleanup settings.
Run the spectral matching workflow as an ordered pipeline.
steps defines the exact step order. Intermediate outputs are written inside the pipeline temp directory. The final step writes to shared_output_image_path:
- If the final step writes multiple rasters,
shared_output_image_pathmust be a folder, a template containing$, or a list of paths. - If the final step is merge with merge_rasters_output_tiles=True,
shared_output_image_pathmust be a folder without$; the result's output is that folder. - If the final step writes a single raster or vector, it must be a single file path without
$.
Step-specific options use the underlying function's types and defaults. Shared cache and worker settings additionally support "auto" and default to it; shared_window_size defaults to 1024. Required inputs for optional steps are required only when selecting those steps.
Select create_footprints followed by postprocess_footprints before either seamline step to prepare its polygons. These steps retain the current rasters for later masking and merging. Polygon paths and layer names flow between steps unless an explicit input overrides them. Postprocessing is opt-in because its distances require a suitable projected CRS and tuning for the imagery.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shared_window_scales
|
tuple[int, ...] | None
|
Overview factors shared by all steps with build_overviews enabled, default (2, 4, 8, 16, 32); None or an empty tuple disables overview creation for those steps. |
(2, 4, 8, 16, 32)
|
shared_window_size
|
WindowSize
|
Processing window size; for tiled merge, also the output tile width and height in pixels, default 1024. |
1024
|
shared_image_threads
|
AutoThreads
|
Workers across images in other steps and across output tiles in tiled merge; single-file merge does not use this setting. |
'auto'
|
shared_concurrent_processing_backend
|
ConcurrentProcessingBackend
|
Shared process_pool or dask backend; forwarded to merge only with merge_rasters_output_tiles=True. |
'process_pool'
|
shared_dask_scheduler
|
DaskScheduler
|
Shared Dask scheduler; forwarded to merge only with merge_rasters_output_tiles=True. |
None
|
shared_resume_from_steps
|
Literal['no', 'yes', 'validate']
|
Shared resume mode: "no" overwrites, "yes" skips existing outputs, and "validate" checks existing outputs before reuse; tiled merge applies this to existing tiles in the output folder. |
'no'
|
global_regression_pif_method
|
Literal['entire', 'flood_from_match_points']
|
PIF selection method, default "flood_from_match_points", matching Match.global_regression. |
'flood_from_match_points'
|
global_regression_pif_max_samples
|
int | None
|
Maximum number of PIF samples, default 10000; None disables the cap. |
10000
|
global_regression_pif_min_samples
|
int | None
|
Minimum number of PIF samples, default 10. |
10
|
create_footprints_image_field_name
|
str
|
Image identifier field for generated footprints, default "image"; use the same field name in the seamline step. |
'image'
|
create_footprints_output_layer
|
str
|
Output GeoPackage layer for generated footprints, default "footprints". |
'footprints'
|
create_footprints_band
|
int
|
One-based raster band whose validity mask defines the footprints, default 1. |
1
|
create_footprints_eight_connected
|
bool
|
Use eight-connected polygonization, default True; False uses four-connected polygonization. |
True
|
postprocess_footprints_input_polygons
|
str | None
|
Explicit input polygon path; None uses the preceding footprint step's output. |
None
|
postprocess_footprints_input_layer
|
str | None
|
Explicit input layer; None inherits the preceding footprint step's layer when using its polygons. |
None
|
postprocess_footprints_output_layer
|
str
|
Output GeoPackage layer for processed footprints, default "footprints". |
'footprints'
|
postprocess_footprints_edge_distance
|
float
|
Maximum hole-to-edge distance in projected CRS units, default 800; 0 disables only edge cuts. |
800
|
postprocess_footprints_hole_to_hole_distance
|
float
|
Maximum distance between original holes in the same polygon component, default 800; 0 disables only hole-pair cuts. |
800
|
postprocess_footprints_relative_edge_distance
|
float | None
|
Optional edge-only limit on distance divided by sqrt(hole_area / pi), default None. |
None
|
postprocess_footprints_cut_width
|
int | Literal['hole_size', 'maximum_inscribed_circle']
|
Positive integer width, "hole_size" for the largest diameter, or "maximum_inscribed_circle" (default) for the inscribed diameter. Applies to both cut types; pairs use the smaller width. |
'maximum_inscribed_circle'
|
postprocess_footprints_cut_method
|
Literal['corridor', 'buffer']
|
Hole cutting method, "corridor" (default) or "buffer". |
'corridor'
|
postprocess_footprints_smoothing_radius
|
float
|
Inward smoothing radius in projected CRS units, default 240; 0 disables smoothing. |
240
|
postprocess_footprints_simplify_tolerance
|
float
|
Maximum inward simplification deviation in projected CRS units, default 120; 0 disables simplification. |
120
|
postprocess_footprints_simplify_area_weight
|
float
|
Area retention weight in [0, 1], default 0.5. |
0.5
|
postprocess_footprints_area_filter
|
float | None
|
Optional minimum component area in squared CRS units, default None. |
None
|
postprocess_footprints_area_rank
|
int | None
|
Keep the largest N components for positive N or smallest abs(N) for negative N; 0 or None keeps all; default 1. |
1
|
voronoi_center_seamline_input_polygons
|
str | None
|
Explicit input polygon path; None uses the preceding footprint step's output or creates footprints from the current images if no footprint step has run. |
None
|
voronoi_center_seamline_input_layer
|
str | None
|
Explicit input layer; None inherits the preceding footprint step's layer when using its polygons. |
None
|
voronoi_center_seamline_output_layer
|
str
|
Output GeoPackage layer name for Voronoi seamlines; default "seamlines". |
'seamlines'
|
weighted_seamline_input_polygons
|
str | None
|
Explicit input polygon path; None uses the preceding footprint step's output. One of these sources is required for weighted_seamline. |
None
|
weighted_seamline_input_layer
|
str | None
|
Explicit input layer; None inherits the preceding footprint step's layer when using its polygons. |
None
|
weighted_seamline_rank_function
|
str | None
|
Ranking expression, required when steps includes weighted_seamline. |
None
|
merge_rasters_output_tiles
|
bool
|
Create GeoTIFF tiles with gdal_retile in shared_output_image_path instead of a single GeoTIFF, default False. |
False
|
joint_coregistration_resolution
|
Resolution
|
Shared pixel size strategy (highest, average, lowest), positive int or float pixel size in CRS units, or None to preserve native resolution. |
None
|
joint_coregistration_tie_feature_method
|
Literal['orb']
|
'orb', currently the only supported tie-point detector. |
'orb'
|
joint_coregistration_tie_grid_spacing
|
float
|
Positive CRS-unit distance between ORB search centers; default 500.0; independent of joint_coregistration_local_grid_spacing. |
500.0
|
joint_coregistration_tie_search_radius
|
str
|
Square ORB read-window half-width as a positive number followed by 'crs' or 'px'. Default '128px' uses the coarser input resolution, giving approximately 256-by-256-pixel windows before overlap clipping. |
'128px'
|
joint_coregistration_tie_orb_max_features
|
int
|
Positive int ORB detection cap per image per window; default 100. |
100
|
joint_coregistration_tie_max_matches_per_window
|
int | None
|
Positive int selected-match cap per search window per image pair; default 1; None keeps all surviving matches. |
1
|
joint_coregistration_tie_maximum_displacement
|
float | None
|
Positive CRS-unit distance limiting detected match displacement; None disables the limit. |
None
|
joint_coregistration_tie_ransac_reprojection_threshold
|
float | None
|
Positive CRS-unit inlier threshold; None uses three pixels at the coarser input resolution. |
None
|
joint_coregistration_tie_robust_loss
|
Literal['none', 'huber', 'soft_l1', 'cauchy']
|
'none', 'huber' (default), 'soft_l1', or 'cauchy'; downweights inconsistent ties in both alignment stages. |
'huber'
|
joint_coregistration_tie_robust_loss_scale
|
float | None
|
Positive CRS-unit distance for both alignment stages; None uses the median pair RANSAC threshold, or 1.0 without pairs. |
None
|
joint_coregistration_tie_save_path
|
str | None
|
str output path for selected tie-point JSON in original zero-based pixel coordinates; None disables saving. |
None
|
joint_coregistration_tie_save_crs_path
|
str | None
|
str vector output path such as 'ties.gpkg' or 'ties.geojson', or None; saves both selected points per tie in the original input CRS, linked by tie_id. |
None
|
joint_coregistration_tie_load_path
|
str | None
|
str selected tie-point JSON path or None; reuses saved pairs directly; a missing file warns and loads nothing. |
None
|
joint_coregistration_global_image_movement_penalty_weights
|
dict[str, float] | None
|
Ordered dict[str, positive float] of wcmatch.glob basename patterns; first match wins; unmatched images and None use 1; larger weights resist global movement. |
None
|
joint_coregistration_global_tie_alignment_strength
|
float | str
|
Number in [0, 1] for all images or JSON object string such as '{"base": 0, "*": 1}'; first matching basename rule wins; unmatched images use 1; scales solved global corrections. |
1.0
|
joint_coregistration_local_image_movement_penalty_weights
|
dict[str, float] | None
|
Ordered dict[str, positive float] of wcmatch.glob basename patterns; first match wins; unmatched images and None use 1; larger weights resist local deformation. |
None
|
joint_coregistration_local_tie_alignment_strength
|
float | str
|
Number in [0, 1] for all images or JSON object string such as '{"base": 0, "*": 1}'; first matching basename rule wins; unmatched images use 1; scales solved local displacements. |
1.0
|
global_regression_load_adjustments
|
str | None
|
str statistics JSON path or None; a missing file warns and computes fresh statistics. |
None
|
global_regression_pif_load_ties
|
str | None
|
str selected tie-point JSON path or None; a missing file warns and detects PIF seed matches normally. |
None
|
local_block_adjustment_load_block_maps
|
Tuple[str, List[str]] | Tuple[str, None] | Tuple[None, List[str]] | None
|
(reference_tif_or_None, list_of_local_tifs_or_None) or None; missing files warn and their maps are computed. |
None
|
align_rasters_resolution
|
Resolution
|
Shared pixel size strategy (highest, average, lowest), positive int or float pixel size in CRS units, or None to preserve native resolution. |
None
|
merge_rasters_resolution
|
Literal['highest', 'average', 'lowest'] | int | float
|
Merge resolution strategy (highest, average, lowest) or a positive int or float specifying square output pixels in CRS units for either merge mode; default highest. |
'highest'
|
merge_rasters_overlap
|
int
|
Overlap in pixels between output tiles, default 0; nonzero values require tiled merge and must be smaller than shared_window_size. |
0
|
merge_rasters_build_overviews
|
bool
|
Build overviews using shared_window_scales, default False; tiled merge creates pyramid tiles in numbered subfolders and requires consecutive powers of two starting at 2. |
False
|
merge_rasters_resampling_method
|
Literal['nearest', 'near', 'bilinear', 'cubic', 'cubicspline', 'lanczos']
|
Resampling for both merge modes: nearest (or near), bilinear, cubic, cubicspline, or lanczos, default nearest. |
'nearest'
|
merge_rasters_custom_tiles_csv
|
str | None
|
Optional .csv filename within the tile folder; GDAL writes a headerless, semicolon-delimited index with columns tilename;minx;maxx;miny;maxy in the output CRS, also in each pyramid subfolder; requires tiled merge. |
None
|
merge_rasters_create_vrts
|
str
|
VRT filename within the tile folder, default "MergedImage.vrt"; also creates and links pyramid VRTs as overviews; a custom name requires tiled merge. |
'MergedImage.vrt'
|
Source code in spectralmatch/chain.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 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 | |