Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"@codemirror/state": "~6.5.2",
"@codemirror/view": "~6.38.1",
"@egjs/hammerjs": "^2.0.17",
"@geoengine/openapi-client": "github:geo-engine/openapi-client#ogc_apis_fix",
"@geoengine/openapi-client": "github:geo-engine/openapi-client#tile_management",
"d3": "~7.9.0",
"dagre": "~0.8.5",
"dagre-d3": "~0.6.4",
Expand Down
43 changes: 43 additions & 0 deletions projects/common/src/lib/datasets/datasets.service.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import {Injectable, inject} from '@angular/core';
import {
AddDatasetTile,
DataPath,
Dataset,
DatasetDefinition,
DatasetListing,
DatasetsApi,
DatasetTile,
MetaDataDefinition,
MetaDataSuggestion,
OrderBy,
Provenance,
SuggestMetaDataHandlerRequest,
Symbology,
UpdateDataset,
UpdateDatasetTile,
Volume,
VolumeFileLayersResponse,
} from '@geoengine/openapi-client';
Expand Down Expand Up @@ -132,4 +135,44 @@ export class DatasetsService {

return uploadsApi.listVolumeFileLayersHandler({volumeName, fileName});
}

async getDatasetTiles(datasetName: string, offset = 0, limit = 100): Promise<DatasetTile[]> {
const datasetApi = await firstValueFrom(this.datasetApi);

return datasetApi.getDatasetTilesHandler({
dataset: datasetName,
offset,
limit,
});
}

async updateDatasetTile(datasetName: string, tileId: string, update: UpdateDatasetTile): Promise<void> {
const datasetApi = await firstValueFrom(this.datasetApi);

return datasetApi.updateDatasetTileHandler({
dataset: datasetName,
tile: tileId,
updateDatasetTile: update,
});
}

async addDatasetTiles(datasetName: string, tiles: Array<AddDatasetTile>): Promise<string[]> {
const datasetApi = await firstValueFrom(this.datasetApi);

return datasetApi.addDatasetTilesHandler({
dataset: datasetName,
addDatasetTile: tiles,
});
}

async deleteDatasetTile(datasetName: string, tileIds: Array<string>): Promise<void> {
const datasetApi = await firstValueFrom(this.datasetApi);

return datasetApi.deleteDatasetTilesHandler({
dataset: datasetName,
deleteDatasetTiles: {
tileIds,
},
});
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<div>
Output Measurement:
@if (showOutputMeasurementLabel()) {
Output Measurement:
}
<mat-button-toggle-group
id="measurement-type"
[multiple]="false"
Expand All @@ -15,6 +17,7 @@
<div>
<mat-form-field appearance="fill">
<mat-label>Measurement</mat-label>

<input matInput type="text" required="true" [(ngModel)]="classificationMeasurement.measurement" />
</mat-form-field>
</div>
Expand Down
4 changes: 3 additions & 1 deletion projects/common/src/lib/measurement/measurement.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Component, Input, output} from '@angular/core';
import {Component, input, Input, output} from '@angular/core';
import {FormControl, FormGroup, Validators, FormsModule, ReactiveFormsModule} from '@angular/forms';
import {ClassificationMeasurement, ContinuousMeasurement, Measurement, UnitlessMeasurement} from '@geoengine/openapi-client';
import {MatButtonToggleGroup, MatButtonToggle} from '@angular/material/button-toggle';
Expand Down Expand Up @@ -40,6 +40,8 @@ export class MeasurementComponent {

readonly measurementChange = output<Measurement>();

showOutputMeasurementLabel = input(true);

MeasurementType = MeasurementType;

classificationMeasurement?: ClassificationMeasurement;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {Time, TimeStepDuration} from '../time.model';
import {TimeInputComponent} from '../time-input/time-input.component';
import {FxLayoutDirective, FxLayoutAlignDirective} from '../../util/directives/flexbox-legacy.directive';
import {MatSlideToggle} from '@angular/material/slide-toggle';
import {TimeInterval as TimeIntervalDict} from '@geoengine/openapi-client';

const startBeforeEndValidator = (control: AbstractControl): ValidationErrors | null => {
if (!(control instanceof UntypedFormGroup)) {
Expand Down Expand Up @@ -49,6 +50,21 @@ export interface TimeInterval {
end: Moment;
}

export function time_interval_from_dict(dict: TimeIntervalDict): TimeInterval {
return {
start: moment.utc(dict.start),
timeAsPoint: dict.start == dict.end,
end: moment.utc(dict.end),
};
}

export function time_interval_to_dict(interval: TimeInterval): TimeIntervalDict {
return {
start: interval.start.valueOf(),
end: interval.timeAsPoint ? interval.start.valueOf() : interval.end.valueOf(),
};
}

@Component({
selector: 'geoengine-time-interval-input',
templateUrl: './time-interval-input.component.html',
Expand Down
65 changes: 64 additions & 1 deletion projects/common/src/lib/util/conversions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ import OlFormatGeoJson from 'ol/format/GeoJSON';
import OlGeometry from 'ol/geom/Geometry';
import {Extent as OlExtent} from 'ol/extent';
import {Observable, ReplaySubject} from 'rxjs';
import {BoundingBox2D as BBoxDict, ResponseError} from '@geoengine/openapi-client';
import {
BoundingBox2D as BBoxDict,
GdalDatasetParameters,
GeoTransform,
ResponseError,
SpatialGridDefinition,
SpatialPartition2D,
} from '@geoengine/openapi-client';
import {Time} from '../time/time.model';

/**
Expand Down Expand Up @@ -144,3 +151,59 @@ export function estimateTimeFormat(timeSteps: Array<Time>): string {
export function isDefined<T>(arg: T | null | undefined): arg is T {
return arg !== null && arg !== undefined;
}

export function extractSpatialPartition(gdalParams: GdalDatasetParameters): SpatialPartition2D {
const geoTransform = gdalParams.geoTransform;

const x1 = geoTransform.originCoordinate.x;
const x2 = x1 + geoTransform.xPixelSize * gdalParams.width;
const y1 = geoTransform.originCoordinate.y;
const y2 = y1 + geoTransform.yPixelSize * gdalParams.height;

const minX = Math.min(x1, x2);
const maxX = Math.max(x1, x2);
const minY = Math.min(y1, y2);
const maxY = Math.max(y1, y2);

return {
lowerRightCoordinate: {x: maxX, y: minY},
upperLeftCoordinate: {x: minX, y: maxY},
};
}

export function spatialPartitionFromSpatialGridDefinition(grid: SpatialGridDefinition): SpatialPartition2D {
const geoTransform = grid.geoTransform;
const bounds = grid.gridBounds;

const minX = geoTransform.originCoordinate.x - geoTransform.xPixelSize * bounds.topLeftIdx.xIdx;
const maxX = geoTransform.originCoordinate.x + geoTransform.xPixelSize * bounds.bottomRightIdx.xIdx;

const minY = geoTransform.originCoordinate.y + geoTransform.yPixelSize * bounds.bottomRightIdx.yIdx;
const maxY = geoTransform.originCoordinate.y - geoTransform.yPixelSize * bounds.topLeftIdx.yIdx;

return {
lowerRightCoordinate: {x: maxX, y: minY},
upperLeftCoordinate: {x: minX, y: maxY},
};
}

export function spatialGridDefinitionFromSpatialPartitionAndGeoTransform(
spatialPartition: SpatialPartition2D,
geoTransform: GeoTransform,
): SpatialGridDefinition {
const {originCoordinate, xPixelSize, yPixelSize} = geoTransform;

const topLeftXIdx = Math.round((spatialPartition.upperLeftCoordinate.x - originCoordinate.x) / xPixelSize);
const topLeftYIdx = Math.round((spatialPartition.upperLeftCoordinate.y - originCoordinate.y) / yPixelSize);

const bottomRightXIdx = Math.round((spatialPartition.lowerRightCoordinate.x - originCoordinate.x) / xPixelSize);
const bottomRightYIdx = Math.round((spatialPartition.lowerRightCoordinate.y - originCoordinate.y) / yPixelSize);

return {
geoTransform,
gridBounds: {
topLeftIdx: {xIdx: topLeftXIdx, yIdx: topLeftYIdx},
bottomRightIdx: {xIdx: bottomRightXIdx, yIdx: bottomRightYIdx},
},
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,19 @@ <h2 mat-dialog-title>Create new dataset</h2>
</mat-card-header>

<mat-card-content>
<mat-button-toggle-group id="data-type" [multiple]="false" formControlName="dataType" (change)="updateDataType()">
<mat-button-toggle [value]="DataTypes.Raster">Raster</mat-button-toggle>
<mat-button-toggle-group id="data-type" [multiple]="false" formControlName="datasetType" (change)="updateDataType()">
<mat-button-toggle [value]="DataTypes.SingleBandRaster">Single-BandRaster</mat-button-toggle>
<mat-button-toggle [value]="DataTypes.MultiBandRaster">Multi-Band Raster</mat-button-toggle>
<mat-button-toggle [value]="DataTypes.Vector">Vector</mat-button-toggle>
</mat-button-toggle-group>

@switch (form.controls.dataType.value) {
@case (DataTypes.Raster) {
@switch (form.controls.datasetType.value) {
@case (DataTypes.SingleBandRaster) {
<geoengine-manager-gdal-metadata-list [dataPath]="dataPath()"></geoengine-manager-gdal-metadata-list>
}
@case (DataTypes.MultiBandRaster) {
<geoengine-manager-gdal-multiband [dataPath]="dataPath()"></geoengine-manager-gdal-multiband>
}
@case (DataTypes.Vector) {
<geoengine-ogr-dataset
[uploadId]="form.controls.uploadId.value"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ import {MatSelect} from '@angular/material/select';
import {MatOption} from '@angular/material/autocomplete';
import {MatButton} from '@angular/material/button';
import {AsyncPipe} from '@angular/common';
import {GdalMultiBandComponent} from '../loading-info/gdal-multiband/gdal-multiband.component';

enum DataPaths {
Upload,
Volume,
}

enum DataTypes {
Raster,
enum DatasetTypes {
SingleBandRaster,
MultiBandRaster,
Vector,
}

Expand All @@ -30,7 +32,7 @@ export interface AddDatasetForm {
dataPathType: FormControl<DataPaths>;
uploadId: FormControl<string>;
volumeName: FormControl<string>;
dataType: FormControl<DataTypes>;
datasetType: FormControl<DatasetTypes>;
rawLoadingInfo: FormControl<string>;
}

Expand All @@ -55,6 +57,7 @@ export interface AddDatasetForm {
MatOption,
GdalMetadataListComponent,
OgrDatasetComponent,
GdalMultiBandComponent,
MatButton,
AsyncPipe,
],
Expand All @@ -66,10 +69,11 @@ export class AddDatasetComponent {
private readonly dialog = inject(MatDialog);

DataPaths = DataPaths;
DataTypes = DataTypes;
DataTypes = DatasetTypes;

readonly gdalMetaDataList = viewChild(GdalMetadataListComponent);
readonly ogrDatasetComponent = viewChild(OgrDatasetComponent);
readonly gdalMultiBandComponent = viewChild(GdalMultiBandComponent);

volumes$ = new BehaviorSubject<VolumeDict[]>([]);

Expand All @@ -94,7 +98,7 @@ export class AddDatasetComponent {
nonNullable: true,
validators: [Validators.required],
}),
dataType: new FormControl(DataTypes.Raster, {
datasetType: new FormControl(DatasetTypes.SingleBandRaster, {
nonNullable: true,
validators: [Validators.required],
}),
Expand Down Expand Up @@ -126,7 +130,7 @@ export class AddDatasetComponent {
},
);

this.datasetsService.getVolumes().then((volumes) => {
void this.datasetsService.getVolumes().then((volumes) => {
this.volumes$.next(volumes);
});
}
Expand Down Expand Up @@ -158,7 +162,7 @@ export class AddDatasetComponent {
}

updateDataType(): void {
if (this.form.controls.dataType.value === DataTypes.Raster) {
if (this.form.controls.datasetType.value === DatasetTypes.SingleBandRaster) {
this.form.controls.rawLoadingInfo.clearValidators();
} else {
this.form.controls.rawLoadingInfo.setValidators([Validators.required]);
Expand All @@ -168,10 +172,11 @@ export class AddDatasetComponent {
isCreateDisabled(): boolean {
const general = this.form.pristine || this.form.invalid;

const raster = this.form.controls.dataType.value === DataTypes.Raster && (this.gdalMetaDataList()?.form?.invalid ?? false);
const raster =
this.form.controls.datasetType.value === DatasetTypes.SingleBandRaster && (this.gdalMetaDataList()?.form?.invalid ?? false);

const vector =
this.form.controls.dataType.value === DataTypes.Vector && (this.ogrDatasetComponent()?.formMetaData?.invalid ?? false);
this.form.controls.datasetType.value === DatasetTypes.Vector && (this.ogrDatasetComponent()?.formMetaData?.invalid ?? false);

return general || raster || vector;
}
Expand All @@ -184,7 +189,7 @@ export class AddDatasetComponent {
let sourceOperator = undefined;
let metaData: MetaDataDefinition | undefined = undefined;

if (this.form.controls.dataType.value === DataTypes.Raster) {
if (this.form.controls.datasetType.value === DatasetTypes.SingleBandRaster) {
const gdalMetaDataList = this.gdalMetaDataList();
if (!gdalMetaDataList) {
return;
Expand All @@ -193,7 +198,16 @@ export class AddDatasetComponent {
metaData = gdalMetaDataList.getMetaData();

sourceOperator = 'GdalSource';
} else if (this.form.controls.dataType.value === DataTypes.Vector) {
} else if (this.form.controls.datasetType.value === DatasetTypes.MultiBandRaster) {
const gdalMultiBandComponent = this.gdalMultiBandComponent();
if (!gdalMultiBandComponent) {
return;
}

metaData = gdalMultiBandComponent.getMetaData();

sourceOperator = 'MultiBandGdalSource';
} else if (this.form.controls.datasetType.value === DatasetTypes.Vector) {
const ogrDatasetComponent = this.ogrDatasetComponent();
if (!ogrDatasetComponent) {
return;
Expand Down
Loading
Loading