points2gcp
Convert ground control points for georeferencing raster files from an exported QGIS points file to the format required for the GDAL command line interface (for use with the -gcp
flags).
At the moment, the pointsfile is simply hard-coded into the pythion script, though this could easily be made to be an argument if needed. For example, the provided points file is therefore converted as shown below:
$ python points2gcp.py
Which outputs:
-gcp 499.6696528555430632 -50.14501679731245076 424.87227023637518641 -125.78150985577542542 -gcp 549.98852183650615189 -50.14501679731253603 484.89571689522631459 -123.53063060606851309 -gcp 599.98992161254204802 -50.14501679731253603 546.79489626216650322 -121.27975135636158655 -gcp 650.03100503919358744 -50.10533314669660854 613.57098067013816944 -118.84129883584576248 -gcp 700.11177211646122487 -49.94659854423299095 680.78001036015166392 -116.58605741705028436 -gcp 749.95443729003341105 -49.94659854423299095 753.02407372065772506 -114.19122658742023191 -gcp 449.86667133258640661 -99.78926371780525528 386.48191063006049717 -185.90310531911964631 -gcp 500.02680571108584218 -100.02736562150067812 443.95785054118141488 -185.10482837590970462 -gcp 550.10757278835353645 -100.02736562150067812 503.62905204613008436 -184.63916682570391004 -gcp 600.02960526315746392 -100.02736562150067812 565.89465361651093644 -183.50827448948976439 -gcp 650.03100503919313269 -100.02736562150067812 630.15594754491689855 -182.44390523187635722 -gcp 700.03240481522902883 -100.10673292273249047 696.94511846015450374 -182.04476676027135795 -gcp 750.03380459126515234 -100.02736562150067812 768.25785872024903256 -180.84735134545638857 -gcp 800.11457166853278977 -100.0273656215006497 842.49761443877991951 -179.78298208784306667 -gcp 349.94323908174607141 -150.1875000000003979 292.25769855396765706 -245.92650416714073458 -gcp 400.10337346024556382 -149.87003079507320535 344.8109306486268224 -246.19259648154405795 -gcp 449.94603863381792053 -149.87003079507320535 400.29117820172268694 -246.99087342475405649 -gcp 500.10617301231741294 -149.87003079507320535 456.96884116963354927 -246.99087342475405649 -gcp 549.94883818588982649 -149.87003079507317693 516.30742728157781585 -247.52305805356073165 -gcp 600.42644176931651145 -149.87003079507317693 578.30693653755542982 -248.58742731117402514 -gcp 649.95163773796161877 -150.1875000000003979 641.90299967995315455 -249.1196119399807003 -gcp 700.11177211646111118 -149.55256159014595596 708.42607828078746479 -249.91788888319075568 -gcp 749.95443729003341105 -150.1875000000003979 778.40835696886517781 -250.71616582640078263 -gcp 800.4320408734602097 -149.87003079507317693 850.78546648657288642 -250.98225814080410601 -gcp 849.95723684210520332 -200.03016517357269777 930.0809761787674006 -326.02029080254521887 -gcp 800.11457166853301715 -200.34763437849989032 854.7768512026228791 -323.62545997291516642 -gcp 750.58937569988779615 -200.03016517357269777 782.93192631372187407 -322.02890608649516935 -gcp 700.11177211646111118 -200.03016517357269777 714.01401688325745454 -319.36798294246182195 -gcp 650.26910694288881132 -200.03016517357269777 647.4909382824231443 -317.77142905604182488 -gcp 599.79150335946212635 -200.03016517357269777 584.16096745442894189 -315.64269054081512422 -gcp 549.94883818588982649 -200.34763437849989032 522.6936428272580315 -314.31222896879847895 -gcp 500.10617301231746978 -200.03016517357269777 464.1533336585238203 -312.18349045357177829 -gcp 449.94603863381797737 -200.18889977603635089 407.74176300501630976 -310.71998272435331501 -gcp 400.10337346024550698 -200.03016517357275461 352.66065392352561503 -308.05905958032002445 -gcp 350.26070828667320711 -200.03016517357275461 300.50656030047144895 -307.39382879431167339 -gcp 300.10057390817360101 -200.03016517357275461 249.682928249433985 -305.9303210650933238 -gcp 299.94183930571000474 -250.19029955207230387 249.68292824943378605 -365.80109180584423711 -gcp 350.10197368420961084 -250.19029955207230387 300.77265261487457337 -368.59506110707928883 -gcp 400.26210806270910325 -250.19029955207230387 353.59197702393709051 -371.12293809391098875 -gcp 450.1047732362815168 -250.03156494960870759 407.47567069061290113 -373.65081508074280237 -gcp 499.94743840985370298 -250.03156494960870759 464.81856444453217136 -376.84392285358285335 -gcp 550.10757278835319539 -250.03156494960873601 522.69364282725791782 -380.17007678362449496 -gcp 599.95023796192549526 -250.03156494960873601 584.16096745442894189 -383.36318455646460279 -gcp 650.11037234042510136 -250.03156494960873601 647.22484596801996304 -386.29020001490130198 -gcp 700.27050671892470746 -250.03156494960873601 713.48183225445131939 -390.2815847309513515 -gcp 749.79570268756981477 -250.03156494960873601 781.86755705610903533 -393.74078481819475428 -gcp 799.95583706606930718 -250.03156494960873601 853.18029731620367784 -397.46607721984150885 -gcp 799.95583706606930718 -299.8742301231810643 847.32626639933016577 -471.43974062396944191 -gcp 750.11317189249700732 -299.8742301231810643 775.48134151042893336 -466.11789433590269027 -gcp 699.95303751399751491 -299.8742301231810643 706.37290010798756157 -461.11768647160761248 -gcp 649.79290313549790881 -299.8742301231810643 640.49098231243510781 -456.30439567375907473 -gcp 599.95023796192549526 -299.8742301231810643 577.01570991580695136 -451.19027420104492876 -gcp 550.10757278835319539 -299.8742301231810643 516.54874426783408126 -446.97864475292743691 -gcp 499.94743840985364614 -299.8742301231810643 457.58593199418896802 -442.16535395507884232 -gcp 449.94603863381775 -300.03296472564466058 401.15334296505636758 -438.38307754751781431 -gcp 400.10337346024539329 -300.03296472564466058 346.4517286614931777 -433.87582842887223933 -gcp 349.94323908174584403 -300.03296472564466058 293.79886395731438142 -429.98320419004193127 -gcp 300.10057390817348733 -300.03296472564466058 242.58012397270468341 -426.09057995121162321 -gcp 350.10197368420932662 -350.03436450168055671 280.07224164143894996 -489.1920676122505256 -gcp 399.94463885778168333 -350.03436450168055671 333.54460618537143546 -494.31394161071153803 -gcp 450.10477323628123258 -350.03436450168055671 387.63159560911924473 -499.43581560917243678 -gcp 499.94743840985358929 -350.03436450168055671 445.40633431175899659 -504.96743952751023699 -gcp 550.10757278835308171 -350.0343645016806704 503.18107301439874846 -510.90881336572499549 -gcp 599.95023796192538157 -350.0343645016806704 565.46306083568413214 -516.4404372840627957 -gcp 650.11037234042498767 -350.0343645016806704 629.17917337653864251 -522.58668608221591967 -gcp 700.27050671892448008 -349.71689529675347785 695.96841031646954434 -529.14268480024588825 -gcp 750.11317189249689363 -350.0343645016806704 764.39664693590816569 -536.10843343815281514 -gcp 799.95583706606930718 -350.0343645016806704 836.51263283423861594 -543.48393199593624558 -gcp 800.27330627099649973 -399.87702967525308395 820.95941956895308067 -613.02928516647966717 -gcp 750.11317189249689363 -399.87702967525308395 748.02393383086894119 -604.42453684906513445 -gcp 699.95303751399740122 -399.87702967525308395 677.95669753192305507 -596.43441341146603918 -gcp 650.11037234042510136 -399.87702967525308395 609.93821083236139202 -588.03454005398998561 -gcp 599.95023796192549526 -399.87702967525308395 547.04159813126068457 -580.45416653626773495 -gcp 550.10757278835319539 -399.87702967525308395 484.75961030997524404 -573.2835429384224426 -gcp 499.94743840985370298 -399.87702967525308395 425.14099696788957772 -566.52266926045410855 -gcp 449.78730403135409688 -399.87702967525308395 367.98088314506520646 -559.14717070267033705 -gcp 399.62716965285454762 -399.87702967525308395 313.07439388156359428 -552.38629702470188931 -gcp 449.94603863381792053 -449.87842945128909378 342.16663819282206305 -615.89753460561792053 -gcp 500.10617301231752663 -449.87842945128909378 400.35112681533860268 -623.47790812334039856 -gcp 549.94883818588982649 -449.87842945128909378 461.19898991705497338 -632.0826564407548176 -gcp 600.10897256438943259 -449.87842945128909378 523.07122781846362614 -639.86790491841543371 -gcp 649.95163773796173246 -449.87842945128909378 587.40196523913334659 -649.0872781156452902 -gcp 700.11177211646122487 -449.87842945128909378 656.23995177844881255 -658.51152627281339846 -gcp 749.95443729003363842 -449.87842945128909378 726.51206303733340519 -668.55039930979705787 -gcp 649.95163773796173246 -500.35603303471589243 557.69509604805989511 -705.83764201859287368 -gcp 600.10897256438943259 -500.03856382978864303 492.13510886775952713 -695.9012064615789086 -gcp 549.94883818588982649 -500.03856382978864303 428.62387128684349591 -686.06720838453406941
Similarly, you could write the results to a file with something like this:
$ python points2gcp.py > out.txt
This script is typically used as part of the minirhizotron-transform repo.