[gdal-dev] Making use of SPOT imagery mask files

2021-07-28 Thread Matt.Wilkie
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 
gdal-translate so they're easier to work with.

((cross posted to 
https://gis.stackexchange.com/questions/405077/making-use-of-spot-imagery-mask-files))

In each archive there are a series of mask files in 
gml format, which I can 
read with ogrinfo and Qgis. However the mask files don't have a coordinate 
system so I can't use them with the images.

>From the ogrinfo report it appears the GML are using image row and column 
>pixel dimensions. (The matching source image is 9652 x 57083.)

$ ogrinfo \SPOT6_sample_roi.gml maskfeature

INFO: Open of `\SPOT6_sample_roi.gml'

  using driver `GML' successful.

Metadata:

  NAME=Area of interest mask for product id 
SPOT6_MS_201308032015087_SEN_SPOT6_20160316_1601281mdxzlrvssw12_1



Layer name: MaskFeature

Geometry: Polygon

Feature Count: 1

Extent: (1.00, 1.00) - (9653.00, 57084.00)

Layer SRS WKT:

(unknown)

gml_id: String (0.0) NOT NULL

maskType: String (18.0)

OGRFeature(MaskFeature):0

  gml_id (String) = REGION_OF_INTEREST-0

  maskType (String) = REGION_OF_INTEREST

  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))

The gdalinfo report for the source 
image also 
shows pixel coordinates for the coordinate system:

Corner Coordinates:

Upper Left  (0.0,0.0)

Lower Left  (0.0,57083.0)

Upper Right ( 9652.0,0.0)

Lower Right ( 9652.0,57083.0)

Center  ( 4826.0,28541.5)

However it also has RPC metadata that seems to be enough to have Qgis and 
ArcMap/Pro display it in the right geographical location:

RPC Metadata:

  HEIGHT_OFF=500.0

  HEIGHT_SCALE=500.0

  LAT_OFF=64.90742355

  LAT_SCALE=1.71583845

  ...snip...

  SAMP_OFF=4825

  SAMP_SCALE=4826.0

Sample files at 
https://drive.google.com/drive/folders/119QEECJ42FKt0A9mq55rRmGsT9-5nSZq?usp=sharing
 (The image has been resized to 10% of it's original size.)

How might I marry the raster coordinate system info to the mask files so I can 
use them together?
Thanks in advance for your time and thoughts,

Matt Wilkie
A / Manager
(Geomatics Developer & Administrator)
Environment | Technology, Innovation and Mapping
T 867-667-8133 | Yukon.ca
Hours: 08:30-16:30, Mon-Wed: Office, Thu: Remote, Fri: Away.

___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


Re: [gdal-dev] Making use of SPOT imagery mask files

2021-07-29 Thread Matt.Wilkie
Aha! A small bit of progress:



$ 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

Enter column line values separated by space, and press Return.

0.0 57083.0

-137.766376889524 63.1915449659547 0

9652.0 0.0

-136.420879379204 66.6213864498263 0



These are the corner coordinates of the gdalinfo report, and they match the 
image as ArcMap displays it.



[cid:image002.jpg@01D78490.652687E0]


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.

-Matt


From: gdal-dev 
mailto:gdal-dev-boun...@lists.osgeo.org>> On 
Behalf Of matt.wil...@yukon.ca<mailto:matt.wil...@yukon.ca>
Sent: July 28, 2021 2:58 PM
To: gdal-dev@lists.osgeo.org<mailto:gdal-dev@lists.osgeo.org>
Subject: [gdal-dev] Making use of SPOT imagery mask files


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 
gdal-translate so they're easier to work with.

((cross posted to 
https://gis.stackexchange.com/questions/405077/making-use-of-spot-imagery-mask-files))

In each archive there are a series of mask files in 
gml<https://gis.stackexchange.com/questions/tagged/gml> format, which I can 
read with ogrinfo and Qgis. However the mask files don't have a coordinate 
system so I can't use them with the images.

From the ogrinfo report it appears the GML are using image row and column pixel 
dimensions. (The matching source image is 9652 x 57083.)

$ ogrinfo \SPOT6_sample_roi.gml maskfeature

INFO: Open of `\SPOT6_sample_roi.gml'

  using driver `GML' successful.

Metadata:

  NAME=Area of interest mask for product id 
SPOT6_MS_201308032015087_SEN_SPOT6_20160316_1601281mdxzlrvssw12_1



Layer name: MaskFeature

Geometry: Polygon

Feature Count: 1

Extent: (1.00, 1.00) - (9653.00, 57084.00)

Layer SRS WKT:

(unknown)

gml_id: String (0.0) NOT NULL

maskType: String (18.0)

OGRFeature(MaskFeature):0

  gml_id (String) = REGION_OF_INTEREST-0

  maskType (String) = REGION_OF_INTEREST

  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))

The gdalinfo report for the source 
image<https://gist.github.com/maphew/513404f56b956ef3f1379b70d1d5d87f> also 
shows pixel coordinates for the coordinate system:

Corner Coordinates:

Upper Left  (0.0,0.0)

Lower Left  (0.0,57083.0)

Upper Right ( 9652.0,0.0)

Lower Right ( 9652.0,57083.0)

Center  ( 4826.0,28541.5)

However it also has RPC metadata that seems to be enough to have Qgis and 
ArcMap/Pro display it in the right geographical location:

RPC Metadata:

  HEIGHT_OFF=500.0

  HEIGHT_SCALE=500.0

  LAT_OFF=64.90742355

  LAT_SCALE=1.71583845

  ...snip...

  SAMP_OFF=4825

  SAMP_SCALE=4826.0

Sample files at 
https://drive.google.com/drive/folders/119QEECJ42FKt0A9mq55rRmGsT9-5nSZq?usp=sharing<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>
 (The image has been resized to 10% of it's original size.)

How might I marry the raster coordinate system info to the mask files so I can 
use them together?
Thanks in advance for your time and thoughts,

Matt Wilkie
A / Manager
(Geomatics Developer & Administrator)
Environment | Technology, Innovation and Mapping
T 867-667-8133 | 
Yukon.ca<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>
Hours: 08:30-16:30, Mon-Wed: Office, Thu: Remote, Fri: Away.

___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev