<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=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><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;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
code
        {mso-style-priority:99;
        font-family:"Courier New";}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";
        mso-fareast-language:EN-CA;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.EmailStyle22
        {mso-style-type:personal;
        font-family:"Arial",sans-serif;
        color:windowtext;}
span.EmailStyle23
        {mso-style-type:personal;
        font-family:"Arial",sans-serif;
        color:#1F497D;}
span.EmailStyle25
        {mso-style-type:personal-reply;
        font-family:"Arial",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
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="EN-CA" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Aha! A small bit of progress:<o:p></o:p></span></p>
<p style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><o:p> </o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:27.0pt;margin-bottom:.0001pt">
<span style="font-size:10.0pt;font-family:"Courier New"">$ <b>gdaltransform -rpc DS_SPOT6_201308032015087_LM1_FR1_FR1_FR1_W137N65_10315\PROD_SPOT6_001\VOL_SPOT6_001_A\IMG_SPOT6_MS_001_A\DIM_SPOT6_MS_201308032015087_SEN_1.XML</b><o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:27.0pt;margin-bottom:.0001pt">
<span style="font-size:10.0pt;font-family:"Courier New"">Enter column line values separated by space, and press Return.<o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:27.0pt;margin-bottom:.0001pt">
<span style="font-size:10.0pt;font-family:"Courier New"">0.0 57083.0<o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:27.0pt;margin-bottom:.0001pt">
<span style="font-size:10.0pt;font-family:"Courier New"">-137.766376889524 63.1915449659547 0<o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:27.0pt;margin-bottom:.0001pt">
<span style="font-size:10.0pt;font-family:"Courier New"">9652.0 0.0<o:p></o:p></span></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:27.0pt;margin-bottom:.0001pt">
<span style="font-size:10.0pt;font-family:"Courier New"">-136.420879379204 66.6213864498263 0<o:p></o:p></span></p>
<p style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><o:p> </o:p></span></p>
<p style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">These are the corner coordinates of the gdalinfo report, and they match the image as ArcMap displays it.<o:p></o:p></span></p>
<p style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><o:p> </o:p></span></p>
<p style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><img width="440" height="356" style="width:4.5833in;height:3.7083in" id="Picture_x0020_1" src="cid:image002.jpg@01D78490.652687E0"></span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><o:p></o:p></span></p>
<p style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">So in python we could loop through the vertices of each GML polygon coordinate pair and transform using the above method, but it seems there should or could be a more straightforward path.</span><span style="font-family:"Arial",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif;color:#1F497D">-Matt<o:p></o:p></span></p>
<p class="MsoNormal"><i><span style="font-size:8.0pt;font-family:"Arial",sans-serif;color:#1F497D"><o:p> </o:p></span></i></p>
</div>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#1F497D;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><span lang="EN-US" style="font-size:11.0pt">From:</span></b><span lang="EN-US" style="font-size:11.0pt"> gdal-dev <<a href="mailto:gdal-dev-bounces@lists.osgeo.org">gdal-dev-bounces@lists.osgeo.org</a>>
<b>On Behalf Of </b><a href="mailto:Matt.Wilkie@yukon.ca">Matt.Wilkie@yukon.ca</a><br>
<b>Sent:</b> July 28, 2021 2:58 PM<br>
<b>To:</b> <a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<b>Subject:</b> [gdal-dev] Making use of SPOT imagery mask files<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p>I'm working with SPOT 6 and 7 imagery delivered in DIMAP format. I've figured out how to extract the multispectral and pan-chromatic bands into geotiff with
<code><span style="font-size:10.0pt">gdal-translate</span></code> so they're easier to work with.<o:p></o:p></p>
<p style="margin-left:36.0pt"><i>((cross posted to <a href="https://gis.stackexchange.com/questions/405077/making-use-of-spot-imagery-mask-files">
https://gis.stackexchange.com/questions/405077/making-use-of-spot-imagery-mask-files</a>))<o:p></o:p></i></p>
<p>In each archive there are a series of mask files in <a href="https://gis.stackexchange.com/questions/tagged/gml" title="show questions tagged 'gml'">
gml</a> format, which I can read with <code><span style="font-size:10.0pt">ogrinfo</span></code> and Qgis. However the mask files don't have a coordinate system so I can't use them with the images.<o:p></o:p></p>
<p>From the ogrinfo report it appears the GML are using image row and column pixel dimensions. (The matching source image is 9652 x 57083.)<o:p></o:p></p>
<pre><code>$ ogrinfo \SPOT6_sample_roi.gml maskfeature<o:p></o:p></code></pre>
<pre><code>INFO: Open of `\SPOT6_sample_roi.gml'<o:p></o:p></code></pre>
<pre><code>      using driver `GML' successful.<o:p></o:p></code></pre>
<pre><code>Metadata:<o:p></o:p></code></pre>
<pre><code>  NAME=Area of interest mask for product id SPOT6_MS_201308032015087_SEN_SPOT6_20160316_1601281mdxzlrvssw12_1<o:p></o:p></code></pre>
<pre><code> <o:p></o:p></code></pre>
<pre><code>Layer name: MaskFeature<o:p></o:p></code></pre>
<pre><code>Geometry: Polygon<o:p></o:p></code></pre>
<pre><code>Feature Count: 1<o:p></o:p></code></pre>
<pre><code>Extent: (1.000000, 1.000000) - (9653.000000, 57084.000000)<o:p></o:p></code></pre>
<pre><code>Layer SRS WKT:<o:p></o:p></code></pre>
<pre><code>(unknown)<o:p></o:p></code></pre>
<pre><code>gml_id: String (0.0) NOT NULL<o:p></o:p></code></pre>
<pre><code>maskType: String (18.0)<o:p></o:p></code></pre>
<pre><code>OGRFeature(MaskFeature):0<o:p></o:p></code></pre>
<pre><code>  gml_id (String) = REGION_OF_INTEREST-0<o:p></o:p></code></pre>
<pre><code>  maskType (String) = REGION_OF_INTEREST<o:p></o:p></code></pre>
<pre><code>  POLYGON ((9645.1767578125 6.41328716278076,9645.162109375 5.32240867614746,9645.03125 4.30024194717407,9644.7841796875 3.2741334438324,9644.5390625 2.39344930648804,9644.181640625 1.72693908214569,9643.7666015625 1.20388793945312,9643.4931640625 1.0,8939.99609375 1.0,1.0 4.3671669960022,1.0 28542.5,1 57084,9653 57084,9653.0 45960.265625,9645.1767578125 6.41328716278076))<o:p></o:p></code></pre>
<p><a href="https://gist.github.com/maphew/513404f56b956ef3f1379b70d1d5d87f">The gdalinfo report for the source image</a> also shows pixel coordinates for the coordinate system:<o:p></o:p></p>
<pre><code>Corner Coordinates:<o:p></o:p></code></pre>
<pre><code>Upper Left  (    0.0,    0.0)<o:p></o:p></code></pre>
<pre><code>Lower Left  (    0.0,57083.0)<o:p></o:p></code></pre>
<pre><code>Upper Right ( 9652.0,    0.0)<o:p></o:p></code></pre>
<pre><code>Lower Right ( 9652.0,57083.0)<o:p></o:p></code></pre>
<pre><code>Center      ( 4826.0,28541.5)<o:p></o:p></code></pre>
<p>However it also has RPC metadata that seems to be enough to have Qgis and ArcMap/Pro display it in the right geographical location:<o:p></o:p></p>
<pre><code>RPC Metadata:<o:p></o:p></code></pre>
<pre><code>  HEIGHT_OFF=500.0<o:p></o:p></code></pre>
<pre><code>  HEIGHT_SCALE=500.0<o:p></o:p></code></pre>
<pre><code>  LAT_OFF=64.90742355<o:p></o:p></code></pre>
<pre><code>  LAT_SCALE=1.71583845<o:p></o:p></code></pre>
<pre><code>  ...snip...<o:p></o:p></code></pre>
<pre><code>  SAMP_OFF=4825<o:p></o:p></code></pre>
<pre><code>  SAMP_SCALE=4826.0<o:p></o:p></code></pre>
<p>Sample files at <a href="https://imsva91-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=https%3a%2f%2fdrive.google.com%2fdrive%2ffolders%2f119QEECJ42FKt0A9mq55rRmGsT9%2d5nSZq%3fusp%3dsharing&umid=DDB23C05-C836-5F05-8C43-D9C4E8793F41&auth=c132af8ee7c9d1278d61a701569070a095ce962e-8392e73310668c1bcd34a5a3858e847f80e42556">
https://drive.google.com/drive/folders/119QEECJ42FKt0A9mq55rRmGsT9-5nSZq?usp=sharing</a> (The image has been resized to 10% of it's original size.)<o:p></o:p></p>
<p><strong>How might I marry the raster coordinate system info to the mask files so I can use them together?</strong><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;mso-fareast-language:EN-US">Thanks in advance for your time and thoughts,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-top:4.0pt;line-height:115%;text-autospace:none;vertical-align:middle">
<b><span lang="EN-US" style="font-size:9.0pt;line-height:115%;font-family:"Arial",sans-serif">Matt Wilkie</span></b><span lang="EN-US" style="font-size:9.0pt;line-height:115%;font-family:"Arial",sans-serif"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif">A / Manager<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif">(Geomatics Developer & Administrator)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif">Environment
<span style="color:#2E74B5">|</span> Technology, Innovation and Mapping<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:"Arial",sans-serif">T 867-667-8133
<span style="color:#2E74B5">|</span> </span><u><span style="font-size:9.0pt;font-family:"Arial",sans-serif"><a href="https://imsva91-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=http%3a%2f%2fyukon.ca&umid=DDB23C05-C836-5F05-8C43-D9C4E8793F41&auth=c132af8ee7c9d1278d61a701569070a095ce962e-b4a5ffa0a5f9c86e6d2b5c3020b56a517356be74"><span lang="EN-US" style="color:windowtext">Yukon.ca</span></a><o:p></o:p></span></u></p>
<p class="MsoNormal"><i><span style="font-size:9.0pt;font-family:"Arial",sans-serif">Hours: 08:30-16:30, Mon-Wed: Office, Thu: Remote, Fri: Away.<o:p></o:p></span></i></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
</div>
</body>
</html>