fix: Fix vector with KATO geometry
This commit is contained in:
@@ -31,7 +31,7 @@ type DatasetRepository interface {
|
||||
Delete(ctx context.Context, id uuid.UUID) error
|
||||
MarkParsed(ctx context.Context, id uuid.UUID, cols []domain.AttributeColumn) error
|
||||
MarkParseFailed(ctx context.Context, id uuid.UUID, reason string) error
|
||||
MarkReady(ctx context.Context, id uuid.UUID) error
|
||||
MarkReady(ctx context.Context, id uuid.UUID, geometry []byte) error
|
||||
MarkConverted(ctx context.Context, id uuid.UUID, cogKey string, footprint []byte) error
|
||||
SetProperties(ctx context.Context, id uuid.UUID, properties, geometry []byte) error
|
||||
SaveMapping(ctx context.Context, id uuid.UUID, katoColumn string, years []domain.YearColumn) (domain.Dataset, error)
|
||||
@@ -515,9 +515,11 @@ func (s *DatasetService) SaveMapping(ctx context.Context, id uuid.UUID, in Mappi
|
||||
}
|
||||
|
||||
// Extract reads a mapped dataset's file, unpivots its attribute table into
|
||||
// observations keyed by KATO code and date, and marks the dataset ready. It is
|
||||
// invoked by the worker. Permanent failures (unparsable file) are recorded;
|
||||
// transient failures (storage/DB) are returned for retry.
|
||||
// observations keyed by KATO code and date, records the dissolved feature
|
||||
// geometry, and marks the dataset ready. It is invoked by the worker. Permanent
|
||||
// failures (unparsable file) are recorded; transient failures (storage/DB) are
|
||||
// returned for retry. Geometry extraction is best-effort: a failure leaves
|
||||
// geometry unset rather than failing the job.
|
||||
func (s *DatasetService) Extract(ctx context.Context, id uuid.UUID) error {
|
||||
dataset, err := s.repo.GetByID(ctx, id)
|
||||
if err != nil {
|
||||
@@ -541,7 +543,9 @@ func (s *DatasetService) Extract(ctx context.Context, id uuid.UUID) error {
|
||||
if err := s.repo.ReplaceObservations(ctx, id, obs); err != nil {
|
||||
return err // transient
|
||||
}
|
||||
return s.repo.MarkReady(ctx, id)
|
||||
|
||||
geometry := s.vectorGeometry(ctx, dataset.Filename, data)
|
||||
return s.repo.MarkReady(ctx, id, geometry)
|
||||
}
|
||||
|
||||
// buildObservations unpivots rows into observations. Rows without a KATO code
|
||||
|
||||
Reference in New Issue
Block a user