Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(portal): try to detect epsg code from vector added by url #1147

Open
wants to merge 1 commit into
base: next
Choose a base branch
from
Open
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
29 changes: 24 additions & 5 deletions src/app/pages/portal/portal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import {
WfsWorkspace,
addStopToStore,
computeOlFeaturesExtent,
detectFileEPSG,
featureFromOl,
featureToSearchResult,
generateIdFromSourceOptions,
Expand Down Expand Up @@ -91,7 +92,14 @@ import type { default as OlGeometry } from 'ol/geom/Geometry';
import * as olProj from 'ol/proj';

import { BehaviorSubject, Subscription, combineLatest, of } from 'rxjs';
import { debounceTime, first, pairwise, skipWhile, take } from 'rxjs/operators';
import {
concatMap,
debounceTime,
first,
pairwise,
skipWhile,
take
} from 'rxjs/operators';
import { getAppVersion } from 'src/app/app.utils';
import { EnvironmentOptions } from 'src/environments/environnement.interface';

Expand Down Expand Up @@ -1443,10 +1451,21 @@ export class PortalComponent implements OnInit, OnDestroy {
type: data.type,
lastModified: Date.now()
});
this.importService.import(file).subscribe(
(features: Feature[]) => this.onFileImportSuccess(file, features),
(error: Error) => this.onFileImportError(file, error)
);
detectFileEPSG({ file })
.pipe(
skipWhile((code) => !code),
first(),
concatMap((epsgCode) => {
return this.importService.import(
file,
epsgCode === 'epsgNotDefined' ? undefined : epsgCode
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'ai l'impression que cet observable pourrait bloquer lorsqu'un fichier n'a pas de projection.
Au niveau du skipWhile((code) => !code), cela pourrait faire en sorte qu'on accède jamais à la suite des étapes, qu'est-ce que t'en pense?

Copy link
Member Author

@pelord pelord Apr 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

);
})
)
.subscribe(
(features: Feature[]) => this.onFileImportSuccess(file, features),
(error: Error) => this.onFileImportError(file, error)
);
});
}
}
Expand Down
Loading