5

I have a GeoTiff image consisting of 400 Ground control points.

I have now extracted all of these points into one string so that I can implement it into gdal_translate.

print gcp_string
-gcp 0.0 0.0 68.7535734331 81.6383694455 -gcp 524.0 0.0 67.8801524103 81.7775083606 -gcp 1048.0 0.0 66.9770925387 81.9146972712 -gcp 1572.0 0.0 66.0433103806 82.0498354298 -gcp 2096.0 0.0 65.0777120396 82.1828165964 -gcp 2620.0 0.0 64.0791988218 82.3135289263 -gcp 3144.0 0.0 63.0466743807 82.4418548213 -gcp 3668.0 0.0 61.9790532927 82.5676707895 -gcp 4192.0 0.0 60.875271098 82.6908473352 -gcp 4716.0 0.0 59.7342958801 82.8112488932 -gcp 5240.0 0.0 58.5551414743 82.9287338201 -gcp 5764.0 0.0 57.3368823882 83.0431544508 -gcp 6288.0 0.0 56.0786704967 83.1543572296 -gcp 6812.0 0.0 54.7797535304 83.2621829288 -gcp 7336.0 0.0 53.439495322 83.3664669648 -gcp 7860.0 0.0 52.0573976933 83.4670398266 -gcp 8384.0 0.0 50.6331237731 83.5637276304 -gcp 8908.0 0.0 49.1665224157 83.6563528125 -gcp 9432.0 0.0 47.6576532586 83.7447349757 -gcp 9956.0 0.0 46.1068118075 83.8286918967 -gcp 10464.0 0.0 44.5637779475 83.9056878166 -gcp 0.0 500.0 67.8290425489 81.5159728482 -gcp 524.0 500.0 66.9537649982 81.6531515131 -gcp 1048.0 500.0 66.0496675184 81.7883450613 -gcp 1572.0 500.0 65.115755027 81.9214540281 -gcp 2096.0 500.0 64.1510283635 82.0523737882 -gcp 2620.0 500.0 63.1544899931 82.1809944799 -gcp 3144.0 500.0 62.1251510895 82.307200898 -gcp 3668.0 500.0 61.0620399152 82.4308723944 -gcp 4192.0 500.0 59.9642115043 82.5518828121 -gcp 4716.0 500.0 58.8307586902 82.670100464 -gcp 5240.0 500.0 57.6608245322 82.7853881671 -gcp 5764.0 500.0 56.4536161913 82.8976033405 -gcp 6288.0 500.0 55.2084202793 83.0065981759 -gcp 6812.0 500.0 53.9246196708 83.1122198889 -gcp 7336.0 500.0 52.60171171 83.2143110618 -gcp 7860.0 500.0 51.2393276789 83.3127100894 -gcp 8384.0 500.0 49.8372533053 83.4072517379 -gcp 8908.0 500.0 48.3954499916 83.4977678292 -gcp 9432.0 500.0 46.9140763306 83.5840880581 -gcp 9956.0 500.0 45.3935093542 83.6660409529 -gcp 10464.0 500.0 43.8825354738 83.7411600321 -gcp 0.0 1000.0 66.9303477723 81.3915362591 -gcp 524.0 1000.0 66.0540923882 81.5267816886 -gcp 1048.0 1000.0 65.1498417108 81.6600102582 -gcp 1572.0 1000.0 64.2166840492 81.7911239623 -gcp 2096.0 1000.0 63.2537091299 81.9200199591 -gcp 2620.0 1000.0 62.2600137546 82.0465905288 -gcp 3144.0 1000.0 61.2347087331 82.1707230017 -gcp 3668.0 1000.0 60.1769269872 82.2922996966 -gcp 4192.0 1000.0 59.0858328039 82.411197892 -gcp 4716.0 1000.0 57.9606322542 82.5272898423 -gcp 5240.0 1000.0 56.8005848054 82.6404428483 -gcp 5764.0 1000.0 55.6050161477 82.7505193891 -gcp 6288.0 1000.0 54.3733322341 82.8573773222 -gcp 6812.0 1000.0 53.105034499 82.9608701599 -gcp 7336.0 1000.0 51.7997361708 83.0608474297 -gcp 7860.0 1000.0 50.4571795323 83.1571551284 -gcp 8384.0 1000.0 49.0772539111 83.2496362783 -gcp 8908.0 1000.0 47.660014095 83.3381315945 -gcp 9432.0 1000.0 46.2056987722 83.4224802701 -gcp 9956.0 1000.0 44.7147484998 83.5025208855 -gcp 10464.0 1000.0 43.2349706924 83.575852614 -gcp 0.0 1500.0 66.0562624411 81.2652281601 -gcp 524.0 1500.0 65.1798186215 81.3985678027 -gcp 1048.0 1500.0 64.2762046188 81.5298619773 -gcp 1572.0 1500.0 63.3445871261 81.6590142925 -gcp 2096.0 1500.0 62.3841389562 81.7859238343 -gcp 2620.0 1500.0 61.3940445817 81.910485155 -gcp 3144.0 1500.0 60.3735068502 82.0325882324 -gcp 3668.0 1500.0 59.3217547512 82.1521184418 -gcp 4192.0 1500.0 58.2380521924 82.2689565592 -gcp 4716.0 1500.0 57.1217077779 82.3829788089 -gcp 5240.0 1500.0 55.972085597 82.4940569643 -gcp 5764.0 1500.0 54.7886170218 82.6020585067 -gcp 6288.0 1500.0 53.5708134937 82.7068468478 -gcp 6812.0 1500.0 52.3182802486 82.808281624 -gcp 7336.0 1500.0 51.0307308855 82.9062190672 -gcp 7860.0 1500.0 49.7080026304 83.0005124606 -gcp 8384.0 1500.0 48.3500720825 83.0910126858 -gcp 8908.0 1500.0 46.9570711596 83.1775688687 -gcp 9432.0 1500.0 45.529302878 83.2600291295 -gcp 9956.0 1500.0 44.0672565219 83.3382414392 -gcp 10464.0 1500.0 42.6177788387 83.4098673173 -gcp 0.0 2000.0 65.2076466939 81.1368878868 -gcp 524.0 2000.0 64.3317864306 81.2683537599 -gcp 1048.0 2000.0 63.4295783029 81.3977488235 -gcp 1572.0 2000.0 62.5002625258 81.5249784145 -gcp 2096.0 2000.0 61.5430893838 81.6499436548 -gcp 2620.0 2000.0 60.5573246034 81.7725414655 -gcp 3144.0 2000.0 59.5422558052 81.8926645536 -gcp 3668.0 2000.0 58.497199895 82.0102014113 -gcp 4192.0 2000.0 57.4215113339 82.1250363458 -gcp 4716.0 2000.0 56.3145912659 82.237049554 -gcp 5240.0 2000.0 55.1758974908 82.3461172461 -gcp 5764.0 2000.0 54.0049552687 82.4521118251 -gcp 6288.0 2000.0 52.8013689217 82.5549021269 -gcp 6812.0 2000.0 51.5648341719 82.6543537249 -gcp 7336.0 2000.0 50.2951511175 82.7503293053 -gcp 7860.0 2000.0 48.9922376995 82.8426891192 -gcp 8384.0 2000.0 47.6561434588 82.931291516 -gcp 8908.0 2000.0 46.2870633219 83.0159935648 -gcp 9432.0 2000.0 44.8853510851 83.096651766 -gcp 9956.0 2000.0 43.4515322019 83.1731228569 -gcp 10464.0 2000.0 42.031511307 83.2431273487 -gcp 0.0 2500.0 64.3805863174 81.0070873979 -gcp 524.0 2500.0 63.5059185671 81.1367053897 -gcp 1048.0 2500.0 62.6057168924 81.2642298487 -gcp 1572.0 2500.0 61.6792901495 81.3895679545 -gcp 2096.0 2500.0 60.7259605991 81.5126229617 -gcp 2620.0 2500.0 59.7450690656 81.633294238 -gcp 3144.0 2500.0 58.7359810887 81.7514772762 -gcp 3668.0 2500.0 57.6980939116 81.8670637173 -gcp 4192.0 2500.0 56.6308442323 81.9799414038 -gcp 4716.0 2500.0 55.5337166829 82.0899944759 -gcp 5240.0 2500.0 54.4062530112 82.1971035145 -gcp 5764.0 2500.0 53.2480619403 82.3011457367 -gcp 6288.0 2500.0 52.0588296626 82.4019952471 -gcp 6812.0 2500.0 50.8383309022 82.4995233494 -gcp 7336.0 2500.0 49.5864404467 82.5935989214 -gcp 7860.0 2500.0 48.303145006 82.684088859 -gcp 8384.0 2500.0 46.9885552132 82.7708585935 -gcp 8908.0 2500.0 45.6429175257 82.8537726857 -gcp 9432.0 2500.0 44.2666257315 82.9326954996 -gcp 9956.0 2500.0 42.8602317106 83.0074919573 -gcp 10464.0 2500.0 41.4687221962 83.0759389265 -gcp 0.0 3000.0 63.5792898678 80.8751553883 -gcp 524.0 3000.0 62.7065052858 81.0029642566 -gcp 1048.0 3000.0 61.8089927381 81.1286599088 -gcp 1572.0 3000.0 60.8861249887 81.2521514645 -gcp 2096.0 3000.0 59.9372909484 81.3733443948 -gcp 2620.0 3000.0 58.9619005895 81.4921405823 -gcp 3144.0 3000.0 57.9593907701 81.6084383537 -gcp 3668.0 3000.0 56.9292318043 81.722132524 -gcp 4192.0 3000.0 55.8709346914 81.833114469 -gcp 4716.0 3000.0 54.784058957 81.9412722389 -gcp 5240.0 3000.0 53.6682210748 82.0464907162 -gcp 5764.0 3000.0 52.5231034334 82.1486518225 -gcp 6288.0 3000.0 51.3484638007 82.2476347773 -gcp 6812.0 3000.0 50.1441452186 82.3433164111 -gcp 7336.0 3000.0 48.9100862298 82.4355715369 -gcp 7860.0 3000.0 47.6463313039 82.5242733832 -gcp 8384.0 3000.0 46.3530412916 82.6092940915 -gcp 8908.0 3000.0 45.0305036878 82.6905052826 -gcp 9432.0 3000.0 43.6791424401 82.7677786916 -gcp 9956.0 3000.0 42.2995269923 82.8409868742 -gcp 10464.0 3000.0 40.9357458421 82.9079598268 -gcp 0.0 3500.0 62.794402403 80.7424598837 -gcp 524.0 3500.0 61.9239077668 80.8684756664 -gcp 1048.0 3500.0 61.0294739276 80.9923608044 -gcp 1572.0 3500.0 60.1105333541 81.1140263579 -gcp 2096.0 3500.0 59.1665368713 81.2333800145 -gcp 2620.0 3500.0 58.1969583301 81.3503261631 -gcp 3144.0 3500.0 57.2013001089 81.4647659436 -gcp 3668.0 3500.0 56.1790992718 81.5765973056 -gcp 4192.0 3500.0 55.1299342916 81.6857150974 -gcp 4716.0 3500.0 54.0534322833 81.792011192 -gcp 5240.0 3500.0 52.9492767092 81.8953746561 -gcp 5764.0 3500.0 51.8172155165 81.9956919643 -gcp 6288.0 3500.0 50.6570696565 82.0928472621 -gcp 6812.0 3500.0 49.4687419201 82.1867226776 -gcp 7336.0 3500.0 48.2522259935 82.2771986862 -gcp 7860.0 3500.0 47.0076156131 82.3641545308 -gcp 8384.0 3500.0 45.7351136602 82.4474686986 -gcp 8908.0 3500.0 44.4350410003 82.5270194587 -gcp 9432.0 3500.0 43.1078448303 82.6026854604 -gcp 9956.0 3500.0 41.7541062592 82.6743463922 -gcp 10464.0 3500.0 40.4170448829 82.7398836608 -gcp 0.0 4000.0 62.0352174853 80.6075808332 -gcp 524.0 4000.0 61.1676183384 80.7318483408 -gcp 1048.0 4000.0 60.2768579869 80.8539703523 -gcp 1572.0 4000.0 59.3624239295 80.9738599976 -gcp 2096.0 4000.0 58.4238238368 81.0914272773 -gcp 2620.0 4000.0 57.460589936 81.2065791558 -gcp 3144.0 4000.0 56.4722841645 81.3192196269 -gcp 3668.0 4000.0 55.4585039073 81.4292497885 -gcp 4192.0 4000.0 54.4188882191 81.5365679447 -gcp 4716.0 4000.0 53.353124469 81.6410697425 -gcp 5240.0 4000.0 52.2609553668 81.7426483497 -gcp 5764.0 4000.0 51.1421863258 81.8411946742 -gcp 6288.0 4000.0 49.9966931137 81.9365976268 -gcp 6812.0 4000.0 48.8244297253 82.0287444305 -gcp 7336.0 4000.0 47.6254363886 82.1175209758 -gcp 7860.0 4000.0 46.3998475923 82.2028122254 -gcp 8384.0 4000.0 45.1478999907 82.2845026707 -gcp 8908.0 4000.0 43.8699400088 82.3624768398 -gcp 9432.0 4000.0 42.5664309394 82.4366198593 -gcp 9956.0 4000.0 41.2379592875 82.5068180697 -gcp 10464.0 4000.0 39.9268954797 82.5710012085 -gcp 0.0 4500.0 61.2921133836 80.4718994224 -gcp 524.0 4500.0 60.4277335918 80.5944405548 -gcp 1048.0 4500.0 59.5409531588 80.7148229016 -gcp 1572.0 4500.0 58.6313103043 80.8329617503 -gcp 2096.0 4500.0 57.6983649534 80.9487694709 -gcp 2620.0 4500.0 56.7417028061 81.0621556309 -gcp 3144.0 4500.0 55.760940128 81.1730270787 -gcp 3668.0 4500.0 54.7557290669 81.2812880343 -gcp 4192.0 4500.0 53.7257633861 81.3868402034 -gcp 4716.0 4500.0 52.6707845494 81.489582925 -gcp 5240.0 4500.0 51.5905881101 81.5894133548 -gcp 5764.0 4500.0 50.4850303578 81.6862266881 -gcp 6288.0 4500.0 49.3540351758 81.7799164223 -gcp 6812.0 4500.0 48.1976010443 81.8703746602 -gcp 7336.0 4500.0 47.0158081083 81.957492456 -gcp 7860.0 4500.0 45.8088252078 82.0411602043 -gcp 8384.0 4500.0 44.576916738 82.1212680743 -gcp 8908.0 4500.0 43.3204491852 82.1977064911 -gcp 9432.0 4500.0 42.0398971475 82.2703666619 -gcp 9956.0 4500.0 40.7358486281 82.3391411497 -gcp 10464.0 4500.0 39.4498531331 82.4020064522 -gcp 0.0 5000.0 60.5779414802 80.3335201748 -gcp 524.0 5000.0 59.717457033 80.4543842124 -gcp 1048.0 5000.0 58.8353133417 80.5730804959 -gcp 1572.0 5000.0 57.931096575 80.6895262319 -gcp 2096.0 5000.0 57.0044153843 80.8036359867 -gcp 2620.0 5000.0 56.0549047722 80.9153217949 -gcp 3144.0 5000.0 55.0822305977 81.0244932428 -gcp 3668.0 5000.0 54.0860945315 81.1310575609 -gcp 4192.0 5000.0 53.0662393545 81.2349197411 -gcp 4716.0 5000.0 52.0224545359 81.335982686 -gcp 5240.0 5000.0 50.9545820434 81.434147393 -gcp 5764.0 5000.0 49.8625223426 81.5293131753 -gcp 6288.0 5000.0 48.7462405403 81.6213779193 -gcp 6812.0 5000.0 47.6057726113 81.7102383798 -gcp 7336.0 5000.0 46.4412316361 81.7957905127 -gcp 7860.0 5000.0 45.252813956 81.8779298467 -gcp 8384.0 5000.0 44.040805128 81.9565518954 -gcp 8908.0 5000.0 42.8055855407 82.0315526093 -gcp 9432.0 5000.0 41.5476355229 82.1028288692 -gcp 9956.0 5000.0 40.267539755 82.1702790194 -gcp 10464.0 5000.0 39.0060427302 82.2319228155 -gcp 0.0 5500.0 59.8817175279 80.1940067042 -gcp 524.0 5500.0 59.0254148668 80.3132278596 -gcp 1048.0 5500.0 58.1481787834 80.4302731613 -gcp 1572.0 5500.0 57.2496387552 80.5450619563 -gcp 2096.0 5500.0 56.3294475153 80.6575111547 -gcp 2620.0 5500.0 55.3872846328 80.7675353496 -gcp 3144.0 5500.0 54.4228606872 80.875046911 -gcp 3668.0 5500.0 53.4359218413 80.9799560866 -gcp 4192.0 5500.0 52.4262547065 81.0821711252 -gcp 4716.0 5500.0 51.3936914311 81.1815984299 -gcp 5240.0 5500.0 50.3381149655 81.278142744 -gcp 5764.0 5500.0 49.2594644631 81.3717073702 -gcp 6288.0 5500.0 48.1577407701 81.4621944232 -gcp 6812.0 5500.0 47.0330119529 81.549505116 -gcp 7336.0 5500.0 45.8854187955 81.6335400802 -gcp 7860.0 5500.0 44.7151801805 81.7141997213 -gcp 8384.0 5500.0 43.5225982528 81.7913846076 -gcp 8908.0 5500.0 42.3080632379 81.8649958971 -gcp 9432.0 5500.0 41.0720577681 81.9349357978 -gcp 9956.0 5500.0 39.8151605463 82.001108064 -gcp 10464.0 5500.0 38.5773368063 82.0615739707 -gcp 0.0 6000.0 59.2077530556 80.0527120728 -gcp 524.0 6000.0 58.3560363512 80.1703321357 -gcp 1048.0 6000.0 57.4840929939 80.2857705193 -gcp 1572.0 6000.0 56.5915923179 80.3989486987 -gcp 2096.0 6000.0 55.6782273943 80.5097859073 -gcp 2620.0 6000.0 54.7437183376 80.6181992649 -gcp 3144.0 6000.0 53.7878161652 80.7241038787 -gcp 3668.0 6000.0 52.8103070111 80.8274129504 -gcp 4192.0 6000.0 51.8110165844 80.928037903 -gcp 4716.0 6000.0 50.789814804 81.0258885365 -gcp 5240.0 6000.0 49.7466205644 81.1208732129 -gcp 5764.0 6000.0 48.6814065895 81.2128990725 -gcp 6288.0 6000.0 47.5942043352 81.3018722801 -gcp 6812.0 6000.0 46.4851088918 81.3876983017 -gcp 7336.0 6000.0 45.3542838238 81.4702822117 -gcp 7860.0 6000.0 44.2019658741 81.5495290304 -gcp 8384.0 6000.0 43.0284694378 81.6253440925 -gcp 8908.0 6000.0 41.8341906949 81.6976334471 -gcp 9432.0 6000.0 40.6196112686 81.7663042884 -gcp 9956.0 6000.0 39.38530126 81.8312654174 -gcp 10464.0 6000.0 38.1704677934 81.890617253 -gcp 0.0 6500.0 58.5448406714 79.9111816492 -gcp 524.0 6500.0 57.6978395574 80.0272135547 -gcp 1048.0 6500.0 56.8312951977 80.1410592098 -gcp 1572.0 6500.0 55.9449138588 80.2526421686 -gcp 2096.0 6500.0 55.0384258067 80.3618839327 -gcp 2620.0 6500.0 54.1115883629 80.4687040847 -gcp 3144.0 6500.0 53.1641894708 80.5730203936 -gcp 3668.0 6500.0 52.1960515759 80.6747489251 -gcp 4192.0 6500.0 51.207035709 80.7738041715 -gcp 4716.0 6500.0 50.1970457054 80.8700992068 -gcp 5240.0 6500.0 49.1660325127 80.9635458708 -gcp 5764.0 6500.0 48.113998552 81.0540549805 -gcp 6288.0 6500.0 47.041002091 81.1415365694 -gcp 6812.0 6500.0 45.9471615882 81.2259001546 -gcp 7336.0 6500.0 44.8326599507 81.30705503 -gcp 7860.0 6500.0 43.6977486417 81.3849105874 -gcp 8384.0 6500.0 42.5427515518 81.4593766644 -gcp 8908.0 6500.0 41.3680685362 81.5303639199 -gcp 9432.0 6500.0 40.1741784991 81.5977842367 -gcp 9956.0 6500.0 38.961641891 81.6615511506 -gcp 10464.0 6500.0 37.7689357861 81.7198034764 -gcp 0.0 7000.0 57.90496546 79.7676964585 -gcp 524.0 7000.0 57.063055461 79.8821875891 -gcp 1048.0 7000.0 56.2022666946 79.9944899945 -gcp 1572.0 7000.0 55.3223391947 80.1045293034 -gcp 2096.0 7000.0 54.4230370544 80.2122292686 -gcp 2620.0 7000.0 53.5041512395 80.317511904 -gcp 3144.0 7000.0 52.5655028768 80.4202975932 -gcp 3668.0 7000.0 51.6069468197 80.5205052021 -gcp 4192.0 7000.0 50.6283753823 80.6180522094 -gcp 4716.0 7000.0 49.6297221733 80.7128548614 -gcp 5240.0 7000.0 48.6109659878 80.8048283524 -gcp 5764.0 7000.0 47.5721347193 80.8938870314 -gcp 6288.0 7000.0 46.5133092591 80.9799446333 -gcp 6812.0 7000.0 45.4346273418 81.0629145355 -gcp 7336.0 7000.0 44.3362872906 81.1427100377 -gcp 7860.0 7000.0 43.2185516011 81.2192446664 -gcp 8384.0 7000.0 42.0817502912 81.2924325023 -gcp 8908.0 7000.0 40.9262839266 81.3621885333 -gcp 9432.0 7000.0 39.7526262177 81.4284290297 -gcp 9956.0 7000.0 38.5613260662 81.4910719437 -gcp 10464.0 7000.0 37.3901493391 81.548292049 -gcp 0.0 7500.0 57.2801688332 79.6233376655 -gcp 524.0 7500.0 56.4435348341 79.7363147215 -gcp 1048.0 7500.0 55.5886647864 79.847102006 -gcp 1572.0 7500.0 54.7153298091 79.9556271805 -gcp 2096.0 7500.0 53.8233249741 80.0618161997 -gcp 2620.0 7500.0 52.9124718949 80.1655934499 -gcp 3144.0 7500.0 51.9826217581 80.2668818582 -gcp 3668.0 7500.0 51.0336585981 80.3656030064 -gcp 4192.0 7500.0 50.0655027094 80.4616772607 -gcp 4716.0 7500.0 49.0781141297 80.5550239246 -gcp 5240.0 7500.0 48.0714961519 80.6455614152 -gcp 5764.0 7500.0 47.0456988323 80.733207464 -gcp 6288.0 7500.0 46.000822464 80.8178793402 -gcp 6812.0 7500.0 44.9370209799 80.899494096 -gcp 7336.0 7500.0 43.8545052441 80.9779688334 -gcp 7860.0 7500.0 42.7535461772 81.0532209923 -gcp 8384.0 7500.0 41.6344776511 81.125168659 -gcp 8908.0 7500.0 40.4976990733 81.1937308971 -gcp 9432.0 7500.0 39.3436775663 81.2588280976 -gcp 9956.0 7500.0 38.1729496324 81.3203823506 -gcp 10464.0 7500.0 37.0225930688 81.3766030924 -gcp 0.0 8000.0 56.6725834492 79.4777762405 -gcp 524.0 8000.0 55.8414293366 79.5892744511 -gcp 1048.0 8000.0 54.9926622587 79.6985830897 -gcp 1572.0 8000.0 54.1260815494 79.8056318722 -gcp 2096.0 8000.0 53.2415103246 79.9103489525 -gcp 2620.0 8000.0 52.3387978392 80.0126610641 -gcp 3144.0 8000.0 51.417822262 80.112493634 -gcp 3668.0 8000.0 50.4784936725 80.2097708968 -gcp 4192.0 8000.0 49.5207571693 80.3044160249 -gcp 4716.0 8000.0 48.544596028 80.3963512794 -gcp 5240.0 8000.0 47.5500348649 80.4854981824 -gcp 5764.0 8000.0 46.5371427791 80.5717777119 -gcp 6288.0 8000.0 45.5060364423 80.6551105166 -gcp 6812.0 8000.0 44.4568831081 80.7354171508 -gcp 7336.0 8000.0 43.3899035008 80.8126183284 -gcp 7860.0 8000.0 42.305374539 80.8866351953 -gcp 8384.0 8000.0 41.2036318345 80.9573896198 -gcp 8908.0 8000.0 40.0850718958 81.0248045027 -gcp 9432.0 8000.0 38.9501539506 81.0888041045 -gcp 9956.0 8000.0 37.7994012898 81.1493143908 -gcp 10464.0 8000.0 36.6692245314 81.204577885 -gcp 0.0 8500.0 56.079679703 79.3313273648 -gcp 524.0 8500.0 55.2541574309 79.4413742996 -gcp 1048.0 8500.0 54.4116236827 79.5492332017 -gcp 1572.0 8500.0 53.5519037554 79.6548357795 -gcp 2096.0 8500.0 52.6748464175 79.7581123206 -gcp 2620.0 8500.0 51.7803260583 79.858991835 -gcp 3144.0 8500.0 50.8682452316 79.9574021695 -gcp 3668.0 8500.0 49.9385373983 80.0532701216 -gcp 4192.0 8500.0 48.9911697598 80.1465215682 -gcp 4716.0 8500.0 48.026146119 80.2370816133 -gcp 5240.0 8500.0 47.0435097312 80.3248747561 -gcp 5764.0 8500.0 46.0433461163 80.4098250784 -gcp 6288.0 8500.0 45.0257858065 80.4918564521 -gcp 6812.0 8500.0 43.9910070056 80.5708927626 -gcp 7336.0 8500.0 42.9392381235 80.6468581504 -gcp 7860.0 8500.0 41.8707601472 80.7196772684 -gcp 8384.0 8500.0 40.7859087959 80.7892755557 -gcp 8908.0 8500.0 39.6850763958 80.8555795271 -gcp 9432.0 8500.0 38.568713398 80.9185170794 -gcp 9956.0 8500.0 37.4373294503 80.9780178125 -gcp 10464.0 8500.0 36.3266891984 81.0323561042 -gcp 0.0 9000.0 55.5022478885 79.1838511901 -gcp 524.0 9000.0 54.6825084225 79.2924782872 -gcp 1048.0 9000.0 53.846338485 79.3989201095 -gcp 1572.0 9000.0 52.9935870915 79.5031103214 -gcp 2096.0 9000.0 52.1241263309 79.6049812984 -gcp 2620.0 9000.0 51.2378533203 79.7044642701 -gcp 3144.0 9000.0 50.3346925336 79.8014894344 -gcp 3668.0 9000.0 49.4145983092 79.8959860711 -gcp 4192.0 9000.0 48.4775574301 79.9878826683 -gcp 4716.0 9000.0 47.5235917148 80.0771070664 -gcp 5240.0 9000.0 46.5527605843 80.1635866211 -gcp 5764.0 9000.0 45.565163577 80.2472483846 -gcp 6288.0 9000.0 44.5609427915 80.3280193037 -gcp 6812.0 9000.0 43.540285234 80.4058264335 -gcp 7336.0 9000.0 42.5034250412 80.4805971663 -gcp 7860.0 9000.0 41.4506455424 80.5522594748 -gcp 8384.0 9000.0 40.3822811155 80.6207421693 -gcp 8908.0 9000.0 39.2987187787 80.6859751692 -gcp 9432.0 9000.0 38.2003994486 80.7478897888 -gcp 9956.0 9000.0 37.087818783 80.8064190361 -gcp 10464.0 9000.0 35.9961152692 80.8598678099 -gcp 0.0 9500.0 54.9397653544 79.0353890365 -gcp 524.0 9500.0 54.125937975 79.1426272515 -gcp 1048.0 9500.0 53.2962409263 79.247684073 -gcp 1572.0 9500.0 52.4505448665 79.3504950831 -gcp 2096.0 9500.0 51.5887430586 79.450994696 -gcp 2620.0 9500.0 50.7107531445 79.5491163023 -gcp 3144.0 9500.0 49.8165192726 79.6447923817 -gcp 3668.0 9500.0 48.9060143897 79.7379546156 -gcp 4192.0 9500.0 47.9792425879 79.8285340105 -gcp 4716.0 9500.0 47.036241451 79.9164610387 -gcp 5240.0 9500.0 46.0770843628 80.0016657955 -gcp 5764.0 9500.0 45.1018827561 80.0840781738 -gcp 6288.0 9500.0 44.1107882824 80.1636280536 -gcp 6812.0 9500.0 43.1039948831 80.2402455054 -gcp 7336.0 9500.0 42.0817407372 80.3138610077 -gcp 7860.0 9500.0 41.0443100529 80.3844056758 -gcp 8384.0 9500.0 39.9920346643 80.4518115042 -gcp 8908.0 9500.0 38.9252953787 80.5160116207 -gcp 9432.0 9500.0 37.8445230137 80.5769405529 -gcp 9956.0 9500.0 36.7501990464 80.6345345075 -gcp 10464.0 9500.0 35.6768549591 80.6871276444 -gcp 0.0 9990.0 54.4025238585 78.8889705051 -gcp 524.0 9990.0 53.5945947544 78.9948775464 -gcp 1048.0 9990.0 52.7713266458 79.0986079375 -gcp 1572.0 9990.0 51.9326094649 79.2000991134 -gcp 2096.0 9990.0 51.0783552578 79.2992874484 -gcp 2620.0 9990.0 50.2084997845 79.3961084 -gcp 3144.0 9990.0 49.3230044613 79.4904966223 -gcp 3668.0 9990.0 48.4218584532 79.5823860766 -gcp 4192.0 9990.0 47.5050808116 79.6717101527 -gcp 4716.0 9990.0 46.5727225988 79.7584018057 -gcp 5240.0 9990.0 45.6248689685 79.8423937078 -gcp 5764.0 9990.0 44.6616411785 79.9236184165 -gcp 6288.0 9990.0 43.6831985211 80.0020085559 -gcp 6812.0 9990.0 42.6897401535 80.0774970108 -gcp 7336.0 9990.0 41.681506807 80.1500171321 -gcp 7860.0 9990.0 40.6587823467 80.2195029541 -gcp 8384.0 9990.0 39.6218951463 80.2858894218 -gcp 8908.0 9990.0 38.5712192291 80.3491126296 -gcp 9432.0 9990.0 37.5071751196 80.4091100709 -gcp 9956.0 9990.0 36.4302303342 80.4658208975 -gcp 10464.0 9990.0 35.374339434 80.5176067893

Now, I have one.tif from which I have extracted all the GCP's into one string above.

And now I want to add all these GCP's into two.tif where there are no GCP's

C:\>gdalinfo C:\Users\Gurminder\Documents\Git\Dump\two.tif
Driver: GTiff/GeoTIFF
Files: C:\Users\Gurminder\Documents\Git\Dump\two.tif
       C:\Users\Gurminder\Documents\Git\Dump\two.tif.aux.xml
Size is 10465, 9991
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Metadata:
  AREA_OR_POINT=Area
  TIFFTAG_DATETIME=2016:07:25 04:52:55
  TIFFTAG_IMAGEDESCRIPTION=Sentinel-1A EW GRD MR L1
  TIFFTAG_SOFTWARE=Sentinel-1 IPF 002.71
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0, 9991.0)
Upper Right (10465.0,    0.0)
Lower Right (10465.0, 9991.0)
Center      ( 5232.5, 4995.5)
Band 1 Block=10465x1 Type=Float32, ColorInterp=Gray
  Min=0.000 Max=35.000
  Minimum=0.000, Maximum=35.000, Mean=2.314, StdDev=2.009
  NoData Value=-99.989999999999995
  Metadata:
    STATISTICS_MAXIMUM=35
    STATISTICS_MEAN=2.314333019542
    STATISTICS_MINIMUM=0
    STATISTICS_STDDEV=2.0089220490694

How do I add the GCP's in two.tiff with my gcp_string variable?

2
  • You've mentioned python and gdal_translate, which is a standalone tool. Do you wish to do this from the command line or Python? Aug 10, 2016 at 18:01
  • @Evil I want to do it with python Aug 11, 2016 at 3:07

1 Answer 1

7

you can use gdal_edit.py for this:

gdal_edit.py -gcp 0.0 0.0 68.7535734331 81.6383694455 two.tiff

With gdal_translate you can also do it but have to write a third file:

gdal_translate -gcp 0.0 0.0 68.7535734331 81.6383694455 two.tiff three.tiff

Within Python you could do:

import os
os.system('gdal_edit.py {} two.tiff'.format(gcp_string))

Or if you want to do it in a more pythonic way (adapted from gdal_edit.py):

from osgeo import gdal

gcp_items = filter(None, gcp_string.split("-gcp"))

gcp_list = []
for item in gcp_items:
    pixel, line, x, y = map(float, item.split())
    z = 0
    gcp = gdal.GCP(x, y, z, pixel, line)
    gcp_list.append(gcp)

ds = gdal.Open("two.tiff", gdal.GA_Update)
wkt = ds.GetProjection()
ds.SetGCPs(gcp_list, wkt)
ds = None

Note: this is assuming that the projection of one.tiff and two.tiff are the same. Otherwise you will have to get the wkt from one.tiff.

4
  • in the first three suggestions I get the error as command line too long, is it because I am using osgeo4w on windows? and it has this limitation? Aug 15, 2016 at 16:11
  • Yes, unfortunately the possible length of a command line is pretty short in windows. You can try running the command repeatedly with subsets of your gcps. Or you use linux. There the limit is higher and you can also type really long commands by separating lines with a backslash. Aug 16, 2016 at 12:20
  • Thank you for taking out your time and answering my questions Aug 19, 2016 at 12:13
  • by the way, for netcdf dataset you cannot do this: Error : The NETCDF driver does not support update access to existing datasets Mar 3, 2020 at 7:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.