L1A -> L2
This commit is contained in:
@@ -2,6 +2,7 @@ package producer
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"math"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -58,6 +59,26 @@ type Corners struct {
|
||||
LowerLeft Location `xml:"LowerLeft"`
|
||||
}
|
||||
|
||||
func (corners Corners) Extend() (lng1, lat1, lng2, lat2 float64) {
|
||||
lng1 = math.Min(corners.UpperLeft.Longitude, corners.LowerLeft.Longitude)
|
||||
lng1 = math.Min(lng1, corners.UpperRight.Longitude)
|
||||
lng1 = math.Min(lng1, corners.LowerRight.Longitude)
|
||||
|
||||
lat1 = math.Max(corners.UpperLeft.Latitude, corners.LowerLeft.Latitude)
|
||||
lat1 = math.Max(lat1, corners.UpperRight.Latitude)
|
||||
lat1 = math.Max(lat1, corners.LowerRight.Latitude)
|
||||
|
||||
lng2 = math.Max(corners.UpperLeft.Longitude, corners.LowerLeft.Longitude)
|
||||
lng2 = math.Max(lng2, corners.UpperRight.Longitude)
|
||||
lng2 = math.Max(lng2, corners.LowerRight.Longitude)
|
||||
|
||||
lat2 = math.Min(corners.UpperLeft.Latitude, corners.LowerLeft.Latitude)
|
||||
lat2 = math.Min(lat2, corners.UpperRight.Latitude)
|
||||
lat2 = math.Min(lat2, corners.LowerRight.Latitude)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (r *Registrator) makeProductMeta(scene *Scene) *ProductMeta {
|
||||
meta := &ProductMeta{
|
||||
Satellite: "SJY01",
|
||||
@@ -89,7 +110,7 @@ func (r *Registrator) makeProductMeta(scene *Scene) *ProductMeta {
|
||||
return meta
|
||||
}
|
||||
|
||||
func (r *Registrator) writeProductMeta(productMeta *ProductMeta, filename string) error {
|
||||
func writeProductMeta(productMeta *ProductMeta, filename string) error {
|
||||
output, err := xml.MarshalIndent(productMeta, "", " ")
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user