暂时使用星下点坐标作为图像左上角坐标
This commit is contained in:
@@ -3,6 +3,9 @@ package imageproc
|
||||
import (
|
||||
"encoding/xml"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 定义与XML结构对应的Go结构体
|
||||
@@ -55,7 +58,38 @@ type Corners struct {
|
||||
LowerLeft Location `xml:"LowerLeft"`
|
||||
}
|
||||
|
||||
func WriteProductMeta(productMeta *ProductMeta, filename string) error {
|
||||
func (r *Registrator) makeProductMeta(scene *Scene) *ProductMeta {
|
||||
meta := &ProductMeta{
|
||||
Satellite: "SJY01",
|
||||
Sensor: "PMS",
|
||||
OutputFormat: "GTiff",
|
||||
ProductGenTime: time.Now().Format("2006-01-02T15:04:05"),
|
||||
Width: scene.Width,
|
||||
Height: scene.Height,
|
||||
MapProjection: "GEOGRAPHIC",
|
||||
EarthEllipsoid: "WGS_84",
|
||||
ProductLevel: "L1A",
|
||||
}
|
||||
|
||||
switch scene.Type {
|
||||
case "PAN":
|
||||
meta.Gsd = 1.25
|
||||
meta.Bands = 1
|
||||
case "MSS":
|
||||
meta.Gsd = 5
|
||||
meta.Bands = 4
|
||||
}
|
||||
|
||||
meta.ProductID = filepath.Base(strings.TrimSuffix(scene.Tiff, ".tiff"))
|
||||
startTime, centerTime, endTime := r.SceneImageTime(scene)
|
||||
meta.StartTime = startTime.Format("2006-01-02T15:04:05.000")
|
||||
meta.EndTime = endTime.Format("2006-01-02T15:04:05.000")
|
||||
meta.CentreTime = centerTime.Format("2006-01-02T15:04:05.000")
|
||||
|
||||
return meta
|
||||
}
|
||||
|
||||
func (r *Registrator) writeProductMeta(productMeta *ProductMeta, filename string) error {
|
||||
output, err := xml.MarshalIndent(productMeta, "", " ")
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user