<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<title>email signature</title>
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
span.Shkpostityyli19
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 2.0cm 70.85pt 2.0cm;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="FI" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">The coordinate system and coordinate values must match. Now they don’t.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">gdal_translate -of GTiff -outsize 1400 0 -a_srs EPSG:3857 -a_ullr 172.5 -35.0 175.0 -36.0<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">If the source image is in EPSG:4326 this should work:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">gdal_translate -of GTiff -outsize 1400 0 -a_srs EPSG:4326 -a_ullr 172.5 -35.0 175.0 -36.0 in.tif out_temp.tif<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">and then
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">gdalwarp -t_srs EPSG:3857 out_temp.tif out_final.tif.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">-Jukka Rahkonen-<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">Using -a_srs EPSG:4326 makes more sense but I am not sure if the source image is using that CRS
.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b>Lähettäjä:</b> gdal-dev <gdal-dev-bounces@lists.osgeo.org>
<b>Puolesta </b>Sam McClatchie<br>
<b>Lähetetty:</b> torstai 22. joulukuuta 2022 22.54<br>
<b>Vastaanottaja:</b> gdal-dev@lists.osgeo.org<br>
<b>Aihe:</b> [gdal-dev] problem with wrong corner coordinates in a projected raster<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p>Colleagues<o:p></o:p></p>
<p>I want to georeference and project a raster image. I have an incorrect result where the image is improperly projected, and I am unsure why.<o:p></o:p></p>
<p>The original image is "SST_plot_New_Zealand_Whangarei_clahe.tif" <a href="https://eur06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fu.pc.cd%2Ffy8&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7Ca852b8ccc2b74558135308dae463a020%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C1%7C638073413802579283%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=EVX0k4kjH%2BPud5Ufh4Y4qkz%2BX089vO5jinTUdkja46w%3D&reserved=0">
<http://u.pc.cd/fy8></a>. (Note: I used links to my cloud server directory to avoid sending attachments to the list). I created this image with known bounding box limits:<o:p></o:p></p>
<p>/snip<o:p></o:p></p>
<p># elif region == "New_Zealand_Whangarei":<br>
# lat_min = (-36.0) # needs to exactly match the ERDDAP lat/lon ranges<br>
# lat_max = (-35.0)<br>
# lon_min = (172.5)<br>
# lon_max = (175.0) <o:p></o:p></p>
<p>/end snip<o:p></o:p></p>
<p>I used these commands in the command line:<o:p></o:p></p>
<p>gdal_translate -of GTiff -outsize 1400 0 -a_srs EPSG:3857 -a_ullr 172.5 -35.0 175.0 -36.0 ./SST_plot_New_Zealand_Whangarei_clahe.tif ./test_trans.tif
<br>
<br>
gdalwarp ./test_trans.tif ./test_proj.tif<o:p></o:p></p>
<p>The result from gdal translate is test_trans.tif <a href="https://eur06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fu.pc.cd%2FD4EctalK&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7Ca852b8ccc2b74558135308dae463a020%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C1%7C638073413802579283%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=wEh2%2B5v%2Fw%2BqlCefeLt7wCmgO6PiuO4Lnw8yjoY1NckI%3D&reserved=0">
<http://u.pc.cd/D4EctalK></a>. The result from gdal warp is test_proj.tif <a href="https://eur06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fu.pc.cd%2Fa2actalK&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7Ca852b8ccc2b74558135308dae463a020%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C1%7C638073413802579283%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=CIPJfCE5bCY4vL6bTO3R2LAwr7IV3y1OqXfAnsVMKe0%3D&reserved=0">
<http://u.pc.cd/a2actalK></a>. The problem, as you will see in the ./test_proj.tif file, is that the corner coordinates are not projected, which means the file is not properly projected. I'm obviously making a mistake.Would someone mind helping me to correct
my error, please?<o:p></o:p></p>
<p>Best fishes<o:p></o:p></p>
<p>Sam<o:p></o:p></p>
<p>---<o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Sam McClatchie (fisheries oceanographer)<br>
& Elena Turin (accounting & auditing)<br>
<a href="https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.nzbn.govt.nz%2Fmynzbn%2Fnzbndetails%2F9429049352344%2F%3Fsw%3D&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7Ca852b8ccc2b74558135308dae463a020%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C1%7C638073413802579283%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=4EKPVYwDwvW2pqXWfH0uekwAxot%2F29pQiXdwlnJdFro%3D&reserved=0">FishOcean
Enterprises Ltd</a><br>
<u><a href="https://eur06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.fishocean.info%2F&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7Ca852b8ccc2b74558135308dae463a020%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C1%7C638073413802579283%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=asijzvLfewigcCgclEpj3%2Bw1iZJg0b526UeU2hAtOy4%3D&reserved=0">www.fishocean.info</a></u><br>
38 Upland Rd, Huia, Auckland 0604, New Zealand<br>
cell: 027 752 8495<o:p></o:p></p>
<p><o:p> </o:p></p>
</div>
</div>
</body>
</html>