geonetwork-ui 2.2.0-dev.725d837e → 2.2.0-dev.80d7a273
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/libs/api/metadata-converter/src/lib/gn4/gn4.metadata.mapper.mjs +2 -1
- package/esm2022/libs/api/repository/src/lib/gn4/index.mjs +3 -1
- package/esm2022/libs/common/domain/src/lib/model/record/metadata.model.mjs +1 -1
- package/esm2022/libs/feature/dataviz/src/lib/service/data.service.mjs +5 -4
- package/esm2022/libs/feature/map/src/index.mjs +2 -1
- package/esm2022/libs/feature/map/src/lib/add-layer-from-catalog/add-layer-record-preview/add-layer-record-preview.component.mjs +1 -1
- package/esm2022/libs/feature/map/src/lib/add-layer-from-file/add-layer-from-file.component.mjs +106 -0
- package/esm2022/libs/feature/map/src/lib/add-layer-from-wfs/add-layer-from-wfs.component.mjs +64 -0
- package/esm2022/libs/feature/map/src/lib/feature-map.module.mjs +14 -3
- package/esm2022/libs/feature/map/src/lib/geocoding/geocoding.component.mjs +76 -0
- package/esm2022/libs/feature/map/src/lib/layers-panel/layers-panel.component.mjs +5 -3
- package/esm2022/libs/feature/map/src/lib/map-context/map-context.service.mjs +3 -1
- package/esm2022/libs/ui/catalog/src/lib/organisation-preview/organisation-preview.component.mjs +1 -1
- package/esm2022/libs/ui/elements/src/index.mjs +3 -1
- package/esm2022/libs/ui/elements/src/lib/downloads-list/downloads-list.component.mjs +3 -3
- package/esm2022/libs/ui/elements/src/lib/image-overlay-preview/image-overlay-preview.component.mjs +27 -0
- package/esm2022/libs/ui/elements/src/lib/markdown-parser/markdown-parser.component.mjs +2 -2
- package/esm2022/libs/ui/elements/src/lib/metadata-contact/metadata-contact.component.mjs +3 -3
- package/esm2022/libs/ui/elements/src/lib/related-record-card/related-record-card.component.mjs +3 -3
- package/esm2022/libs/ui/elements/src/lib/thumbnail/thumbnail.component.mjs +7 -3
- package/esm2022/libs/ui/elements/src/lib/ui-elements.module.mjs +10 -3
- package/esm2022/libs/ui/inputs/src/lib/button/button.component.mjs +2 -2
- package/esm2022/libs/ui/layout/src/lib/carousel/carousel.component.mjs +2 -2
- package/esm2022/libs/ui/search/src/lib/record-preview-card/record-preview-card.component.mjs +1 -1
- package/esm2022/libs/ui/search/src/lib/record-preview-feed/record-preview-feed.component.mjs +1 -1
- package/esm2022/libs/ui/search/src/lib/record-preview-list/record-preview-list.component.mjs +1 -1
- package/esm2022/libs/ui/search/src/lib/record-preview-row/record-preview-row.component.mjs +1 -1
- package/esm2022/libs/ui/search/src/lib/record-preview-title/record-preview-title.component.mjs +1 -1
- package/esm2022/libs/util/shared/src/lib/links/link-utils.mjs +29 -13
- package/esm2022/translations/de.json +99 -95
- package/esm2022/translations/en.json +20 -16
- package/esm2022/translations/es.json +4 -0
- package/esm2022/translations/fr.json +4 -0
- package/esm2022/translations/it.json +4 -0
- package/esm2022/translations/nl.json +4 -0
- package/esm2022/translations/pt.json +4 -0
- package/fesm2022/geonetwork-ui.mjs +457 -154
- package/fesm2022/geonetwork-ui.mjs.map +1 -1
- package/libs/api/metadata-converter/src/lib/gn4/gn4.metadata.mapper.d.ts.map +1 -1
- package/libs/api/repository/src/lib/gn4/index.d.ts +2 -0
- package/libs/api/repository/src/lib/gn4/index.d.ts.map +1 -1
- package/libs/common/domain/src/lib/model/record/metadata.model.d.ts +1 -0
- package/libs/common/domain/src/lib/model/record/metadata.model.d.ts.map +1 -1
- package/libs/feature/dataviz/src/lib/service/data.service.d.ts +15 -2
- package/libs/feature/dataviz/src/lib/service/data.service.d.ts.map +1 -1
- package/libs/feature/map/src/index.d.ts +1 -0
- package/libs/feature/map/src/index.d.ts.map +1 -1
- package/libs/feature/map/src/lib/add-layer-from-file/add-layer-from-file.component.d.ts +22 -0
- package/libs/feature/map/src/lib/add-layer-from-file/add-layer-from-file.component.d.ts.map +1 -0
- package/libs/feature/map/src/lib/add-layer-from-wfs/add-layer-from-wfs.component.d.ts +22 -0
- package/libs/feature/map/src/lib/add-layer-from-wfs/add-layer-from-wfs.component.d.ts.map +1 -0
- package/libs/feature/map/src/lib/feature-map.module.d.ts +15 -12
- package/libs/feature/map/src/lib/feature-map.module.d.ts.map +1 -1
- package/libs/feature/map/src/lib/geocoding/geocoding.component.d.ts +20 -0
- package/libs/feature/map/src/lib/geocoding/geocoding.component.d.ts.map +1 -0
- package/libs/feature/map/src/lib/map-context/map-context.service.d.ts +1 -0
- package/libs/feature/map/src/lib/map-context/map-context.service.d.ts.map +1 -1
- package/libs/ui/elements/src/index.d.ts +2 -0
- package/libs/ui/elements/src/index.d.ts.map +1 -1
- package/libs/ui/elements/src/lib/downloads-list/downloads-list.component.d.ts +1 -1
- package/libs/ui/elements/src/lib/image-overlay-preview/image-overlay-preview.component.d.ts +10 -0
- package/libs/ui/elements/src/lib/image-overlay-preview/image-overlay-preview.component.d.ts.map +1 -0
- package/libs/ui/elements/src/lib/thumbnail/thumbnail.component.d.ts +3 -2
- package/libs/ui/elements/src/lib/thumbnail/thumbnail.component.d.ts.map +1 -1
- package/libs/ui/elements/src/lib/ui-elements.module.d.ts +12 -11
- package/libs/ui/elements/src/lib/ui-elements.module.d.ts.map +1 -1
- package/libs/util/shared/src/lib/links/link-utils.d.ts +19 -7
- package/libs/util/shared/src/lib/links/link-utils.d.ts.map +1 -1
- package/package.json +4 -1
- package/src/libs/api/metadata-converter/src/lib/gn4/gn4.metadata.mapper.ts +1 -0
- package/src/libs/api/repository/src/lib/gn4/index.ts +2 -0
- package/src/libs/common/domain/src/lib/index.ts +2 -0
- package/src/libs/common/domain/src/lib/model/record/metadata.model.ts +1 -0
- package/src/libs/feature/dataviz/src/lib/service/data.service.ts +8 -5
- package/src/libs/feature/map/src/index.ts +1 -0
- package/src/libs/feature/map/src/lib/add-layer-from-file/add-layer-from-file.component.css +0 -0
- package/src/libs/feature/map/src/lib/add-layer-from-file/add-layer-from-file.component.html +21 -0
- package/src/libs/feature/map/src/lib/add-layer-from-file/add-layer-from-file.component.ts +107 -0
- package/src/libs/feature/map/src/lib/add-layer-from-wfs/add-layer-from-wfs.component.css +0 -0
- package/src/libs/feature/map/src/lib/add-layer-from-wfs/add-layer-from-wfs.component.html +37 -0
- package/src/libs/feature/map/src/lib/add-layer-from-wfs/add-layer-from-wfs.component.ts +64 -0
- package/src/libs/feature/map/src/lib/feature-map.module.ts +7 -0
- package/src/libs/feature/map/src/lib/geocoding/geocoding.component.css +0 -0
- package/src/libs/feature/map/src/lib/geocoding/geocoding.component.html +39 -0
- package/src/libs/feature/map/src/lib/geocoding/geocoding.component.ts +83 -0
- package/src/libs/feature/map/src/lib/layers-panel/layers-panel.component.html +6 -2
- package/src/libs/feature/map/src/lib/map-context/map-context.service.ts +6 -0
- package/src/libs/ui/elements/src/index.ts +2 -0
- package/src/libs/ui/elements/src/lib/downloads-list/downloads-list.component.html +4 -1
- package/src/libs/ui/elements/src/lib/image-overlay-preview/image-overlay-preview.component.css +0 -0
- package/src/libs/ui/elements/src/lib/image-overlay-preview/image-overlay-preview.component.html +29 -0
- package/src/libs/ui/elements/src/lib/image-overlay-preview/image-overlay-preview.component.ts +15 -0
- package/src/libs/ui/elements/src/lib/markdown-parser/markdown-parser.component.css +52 -52
- package/src/libs/ui/elements/src/lib/metadata-contact/metadata-contact.component.html +1 -1
- package/src/libs/ui/elements/src/lib/related-record-card/related-record-card.component.html +1 -1
- package/src/libs/ui/elements/src/lib/thumbnail/thumbnail.component.ts +4 -0
- package/src/libs/ui/elements/src/lib/ui-elements.module.ts +4 -0
- package/src/libs/ui/inputs/src/lib/button/button.component.css +1 -1
- package/src/libs/ui/layout/src/lib/carousel/carousel.component.css +1 -1
- package/src/libs/util/shared/src/lib/links/link-utils.ts +34 -11
- package/translations/de.json +99 -95
- package/translations/en.json +20 -16
- package/translations/es.json +4 -0
- package/translations/fr.json +4 -0
- package/translations/it.json +4 -0
- package/translations/nl.json +4 -0
- package/translations/pt.json +4 -0
- package/translations/sk.json +4 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { ChangeDetectorRef, Component } from '@angular/core'
|
|
2
|
+
import { MapContextLayerModel } from '../map-context/map-context.model'
|
|
3
|
+
import { MapFacade } from '../+state/map.facade'
|
|
4
|
+
|
|
5
|
+
const INVALID_FILE_FORMAT_ERROR_MESSAGE = 'Invalid file format'
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
selector: 'gn-ui-add-layer-from-file',
|
|
9
|
+
templateUrl: './add-layer-from-file.component.html',
|
|
10
|
+
styleUrls: ['./add-layer-from-file.component.css'],
|
|
11
|
+
})
|
|
12
|
+
export class AddLayerFromFileComponent {
|
|
13
|
+
errorMessage: string | null = null
|
|
14
|
+
successMessage: string | null = null
|
|
15
|
+
loading = false
|
|
16
|
+
readonly acceptedMimeType = ['.geojson']
|
|
17
|
+
readonly maxFileSize = 5000000
|
|
18
|
+
|
|
19
|
+
constructor(
|
|
20
|
+
private mapFacade: MapFacade,
|
|
21
|
+
private changeDetectorRef: ChangeDetectorRef
|
|
22
|
+
) {}
|
|
23
|
+
|
|
24
|
+
async handleFileChange(file: File) {
|
|
25
|
+
if (!file) {
|
|
26
|
+
this.displayMessage(INVALID_FILE_FORMAT_ERROR_MESSAGE, 'error')
|
|
27
|
+
return
|
|
28
|
+
}
|
|
29
|
+
if (file.size > this.maxFileSize) {
|
|
30
|
+
this.displayMessage('File size exceeds the limit of 5MB', 'error')
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
await this.addLayer(file)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
private async addLayer(file: File) {
|
|
37
|
+
this.errorMessage = null
|
|
38
|
+
this.loading = true
|
|
39
|
+
try {
|
|
40
|
+
if (!this.isFileFormatValid(file)) {
|
|
41
|
+
this.displayMessage(INVALID_FILE_FORMAT_ERROR_MESSAGE, 'error')
|
|
42
|
+
return
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const fileExtension = this.getFileExtension(file)
|
|
46
|
+
switch (fileExtension) {
|
|
47
|
+
case 'geojson':
|
|
48
|
+
await this.addGeoJsonLayer(file)
|
|
49
|
+
break
|
|
50
|
+
default:
|
|
51
|
+
this.displayMessage(INVALID_FILE_FORMAT_ERROR_MESSAGE, 'error')
|
|
52
|
+
break
|
|
53
|
+
}
|
|
54
|
+
} catch (error) {
|
|
55
|
+
const err = error as Error
|
|
56
|
+
this.displayMessage('Error loading file: ' + err.message, 'error')
|
|
57
|
+
} finally {
|
|
58
|
+
this.loading = false
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private addGeoJsonLayer(file: File) {
|
|
63
|
+
return new Promise<void>((resolve, reject) => {
|
|
64
|
+
try {
|
|
65
|
+
const reader = new FileReader()
|
|
66
|
+
reader.onload = () => {
|
|
67
|
+
const result = reader.result as string
|
|
68
|
+
const title = file.name.split('.').slice(0, -1).join('.')
|
|
69
|
+
const layerToAdd: MapContextLayerModel = {
|
|
70
|
+
type: 'geojson',
|
|
71
|
+
data: result,
|
|
72
|
+
}
|
|
73
|
+
this.mapFacade.addLayer({ ...layerToAdd, title: title })
|
|
74
|
+
this.displayMessage('File successfully added to map', 'success')
|
|
75
|
+
resolve()
|
|
76
|
+
}
|
|
77
|
+
reader.onerror = reject
|
|
78
|
+
reader.readAsText(file)
|
|
79
|
+
} catch (error) {
|
|
80
|
+
reject(error)
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
private isFileFormatValid(file: File): boolean {
|
|
86
|
+
const fileExtension = this.getFileExtension(file)
|
|
87
|
+
return this.acceptedMimeType.includes(`.${fileExtension}`)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
private getFileExtension(file: File): string | undefined {
|
|
91
|
+
return file.name.split('.').pop()
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
private displayMessage(message: string, type: 'success' | 'error') {
|
|
95
|
+
if (type === 'success') {
|
|
96
|
+
this.successMessage = message
|
|
97
|
+
} else if (type === 'error') {
|
|
98
|
+
this.errorMessage = message
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
setTimeout(() => {
|
|
102
|
+
this.successMessage = null
|
|
103
|
+
this.errorMessage = null
|
|
104
|
+
this.changeDetectorRef.detectChanges()
|
|
105
|
+
}, 5000)
|
|
106
|
+
}
|
|
107
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<div class="flex items-center mb-5">
|
|
2
|
+
<gn-ui-text-input
|
|
3
|
+
[(value)]="wfsUrl"
|
|
4
|
+
(valueChange)="urlChange.next($event)"
|
|
5
|
+
[hint]="'map.wfs.urlInput.hint' | translate"
|
|
6
|
+
class="w-96"
|
|
7
|
+
>
|
|
8
|
+
</gn-ui-text-input>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<div *ngIf="errorMessage" class="text-red-500 mt-2">
|
|
12
|
+
{{ errorMessage }}
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<div *ngIf="loading">
|
|
16
|
+
<p class="loading-message" translate>map.loading.service</p>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<div *ngIf="!loading && layers.length > 0">
|
|
20
|
+
<h2 class="font-bold" translate>map.layers.available</h2>
|
|
21
|
+
<ng-container *ngFor="let layer of layers">
|
|
22
|
+
<div class="flex items-center justify-between my-2 layer-item-tree">
|
|
23
|
+
<p class="max-w-xs overflow-hidden overflow-ellipsis whitespace-nowrap">
|
|
24
|
+
{{ layer.title }}
|
|
25
|
+
</p>
|
|
26
|
+
<gn-ui-button
|
|
27
|
+
*ngIf="layer.name"
|
|
28
|
+
class="layer-add-btn"
|
|
29
|
+
type="primary"
|
|
30
|
+
(buttonClick)="addLayer(layer)"
|
|
31
|
+
extraClass="text-sm !px-2 !py-1"
|
|
32
|
+
translate
|
|
33
|
+
><span translate> map.layer.add </span></gn-ui-button
|
|
34
|
+
>
|
|
35
|
+
</div>
|
|
36
|
+
</ng-container>
|
|
37
|
+
</div>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ChangeDetectorRef, Component, OnInit } from '@angular/core'
|
|
2
|
+
import { WfsEndpoint, WfsFeatureTypeBrief } from '@camptocamp/ogc-client'
|
|
3
|
+
import { Subject } from 'rxjs'
|
|
4
|
+
import {
|
|
5
|
+
MapContextLayerModel,
|
|
6
|
+
MapContextLayerTypeEnum,
|
|
7
|
+
} from '../map-context/map-context.model'
|
|
8
|
+
import { MapFacade } from '../+state/map.facade'
|
|
9
|
+
import { debounceTime } from 'rxjs/operators'
|
|
10
|
+
|
|
11
|
+
@Component({
|
|
12
|
+
selector: 'gn-ui-add-layer-from-wfs',
|
|
13
|
+
templateUrl: './add-layer-from-wfs.component.html',
|
|
14
|
+
styleUrls: ['./add-layer-from-wfs.component.css'],
|
|
15
|
+
})
|
|
16
|
+
export class AddLayerFromWfsComponent implements OnInit {
|
|
17
|
+
wfsUrl = ''
|
|
18
|
+
loading = false
|
|
19
|
+
layers: WfsFeatureTypeBrief[] = []
|
|
20
|
+
wfsEndpoint: WfsEndpoint | null = null
|
|
21
|
+
urlChange = new Subject<string>()
|
|
22
|
+
errorMessage: string | null = null
|
|
23
|
+
|
|
24
|
+
constructor(
|
|
25
|
+
private mapFacade: MapFacade,
|
|
26
|
+
private changeDetectorRef: ChangeDetectorRef
|
|
27
|
+
) {}
|
|
28
|
+
|
|
29
|
+
ngOnInit() {
|
|
30
|
+
this.urlChange.pipe(debounceTime(700)).subscribe(() => this.loadLayers())
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async loadLayers() {
|
|
34
|
+
this.errorMessage = null
|
|
35
|
+
try {
|
|
36
|
+
this.loading = true
|
|
37
|
+
|
|
38
|
+
if (this.wfsUrl.trim() === '') {
|
|
39
|
+
this.layers = []
|
|
40
|
+
return
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
this.wfsEndpoint = await new WfsEndpoint(this.wfsUrl).isReady()
|
|
44
|
+
this.layers = this.wfsEndpoint.getFeatureTypes()
|
|
45
|
+
console.log(this.layers)
|
|
46
|
+
} catch (error) {
|
|
47
|
+
const err = error as Error
|
|
48
|
+
this.layers = []
|
|
49
|
+
this.errorMessage = 'Error loading layers: ' + err.message
|
|
50
|
+
} finally {
|
|
51
|
+
this.loading = false
|
|
52
|
+
this.changeDetectorRef.markForCheck()
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
addLayer(layer: WfsFeatureTypeBrief) {
|
|
57
|
+
const layerToAdd: MapContextLayerModel = {
|
|
58
|
+
name: layer.name,
|
|
59
|
+
url: this.wfsUrl.toString(),
|
|
60
|
+
type: MapContextLayerTypeEnum.WFS,
|
|
61
|
+
}
|
|
62
|
+
this.mapFacade.addLayer({ ...layerToAdd, title: layer.title })
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -21,6 +21,9 @@ import { AddLayerRecordPreviewComponent } from './add-layer-from-catalog/add-lay
|
|
|
21
21
|
import { UiElementsModule } from '../../../../../libs/ui/elements/src'
|
|
22
22
|
import { UiInputsModule } from '../../../../../libs/ui/inputs/src'
|
|
23
23
|
import { AddLayerFromWmsComponent } from './add-layer-from-wms/add-layer-from-wms.component'
|
|
24
|
+
import { AddLayerFromFileComponent } from './add-layer-from-file/add-layer-from-file.component'
|
|
25
|
+
import { AddLayerFromWfsComponent } from './add-layer-from-wfs/add-layer-from-wfs.component'
|
|
26
|
+
import { GeocodingComponent } from './geocoding/geocoding.component'
|
|
24
27
|
|
|
25
28
|
@NgModule({
|
|
26
29
|
declarations: [
|
|
@@ -31,6 +34,9 @@ import { AddLayerFromWmsComponent } from './add-layer-from-wms/add-layer-from-wm
|
|
|
31
34
|
MapContainerComponent,
|
|
32
35
|
AddLayerRecordPreviewComponent,
|
|
33
36
|
AddLayerFromWmsComponent,
|
|
37
|
+
AddLayerFromFileComponent,
|
|
38
|
+
AddLayerFromWfsComponent,
|
|
39
|
+
GeocodingComponent,
|
|
34
40
|
],
|
|
35
41
|
exports: [
|
|
36
42
|
MapContextComponent,
|
|
@@ -38,6 +44,7 @@ import { AddLayerFromWmsComponent } from './add-layer-from-wms/add-layer-from-wm
|
|
|
38
44
|
LayersPanelComponent,
|
|
39
45
|
AddLayerFromCatalogComponent,
|
|
40
46
|
MapContainerComponent,
|
|
47
|
+
GeocodingComponent,
|
|
41
48
|
],
|
|
42
49
|
imports: [
|
|
43
50
|
CommonModule,
|
|
File without changes
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<gn-ui-search-input
|
|
2
|
+
[(value)]="searchText"
|
|
3
|
+
(valueChange)="onSearchChange($event)"
|
|
4
|
+
(keyup.enter)="onEnterPress()"
|
|
5
|
+
[placeholder]="'map.geocoding.placeholder' | translate"
|
|
6
|
+
>
|
|
7
|
+
</gn-ui-search-input>
|
|
8
|
+
<ul
|
|
9
|
+
class="bg-gray-50 border border-gray-200 w-full mt-2 shadow-sm rounded-lg"
|
|
10
|
+
*ngIf="results && results.length"
|
|
11
|
+
>
|
|
12
|
+
<li
|
|
13
|
+
*ngFor="let result of results"
|
|
14
|
+
(click)="zoomToLocation(result)"
|
|
15
|
+
class="flex items-center pl-8 pr-4 py-2 border-b border-gray-200 relative cursor-pointer hover:bg-blue-100 hover:text-gray-800 transition duration-300 ease-in-out"
|
|
16
|
+
>
|
|
17
|
+
<svg
|
|
18
|
+
class="stroke-current text-blue-500 absolute w-5 h-5 left-3 top-3"
|
|
19
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
20
|
+
fill="none"
|
|
21
|
+
viewBox="0 0 24 24"
|
|
22
|
+
stroke="currentColor"
|
|
23
|
+
>
|
|
24
|
+
<path
|
|
25
|
+
stroke-linecap="round"
|
|
26
|
+
stroke-linejoin="round"
|
|
27
|
+
stroke-width="2"
|
|
28
|
+
d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"
|
|
29
|
+
/>
|
|
30
|
+
<path
|
|
31
|
+
stroke-linecap="round"
|
|
32
|
+
stroke-linejoin="round"
|
|
33
|
+
stroke-width="2"
|
|
34
|
+
d="M15 11a3 3 0 11-6 0 3 3 0 016 0z"
|
|
35
|
+
/>
|
|
36
|
+
</svg>
|
|
37
|
+
<span class="font-sans font-semibold ml-4">{{ result.label }}</span>
|
|
38
|
+
</li>
|
|
39
|
+
</ul>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Component, OnDestroy } from '@angular/core'
|
|
2
|
+
import { queryGeoadmin, GeoadminOptions } from '@geospatial-sdk/geocoding'
|
|
3
|
+
import { catchError, from, Subject, takeUntil } from 'rxjs'
|
|
4
|
+
import { debounceTime, switchMap } from 'rxjs/operators'
|
|
5
|
+
import { MapManagerService } from '../manager/map-manager.service'
|
|
6
|
+
import { fromLonLat } from 'ol/proj'
|
|
7
|
+
import { Polygon } from 'ol/geom'
|
|
8
|
+
|
|
9
|
+
@Component({
|
|
10
|
+
selector: 'gn-ui-geocoding',
|
|
11
|
+
templateUrl: './geocoding.component.html',
|
|
12
|
+
styleUrls: ['./geocoding.component.css'],
|
|
13
|
+
})
|
|
14
|
+
export class GeocodingComponent implements OnDestroy {
|
|
15
|
+
searchText = ''
|
|
16
|
+
results: any[] = []
|
|
17
|
+
searchTextChanged = new Subject<string>()
|
|
18
|
+
destroy$ = new Subject<void>()
|
|
19
|
+
|
|
20
|
+
constructor(private mapManager: MapManagerService) {
|
|
21
|
+
this.searchTextChanged
|
|
22
|
+
.pipe(
|
|
23
|
+
debounceTime(300),
|
|
24
|
+
switchMap((searchText) => {
|
|
25
|
+
const options: GeoadminOptions = {
|
|
26
|
+
origins: ['zipcode', 'gg25', 'address'],
|
|
27
|
+
limit: 6,
|
|
28
|
+
}
|
|
29
|
+
return from(queryGeoadmin(searchText, options)).pipe(
|
|
30
|
+
catchError((error) => {
|
|
31
|
+
console.error(error)
|
|
32
|
+
return []
|
|
33
|
+
})
|
|
34
|
+
)
|
|
35
|
+
}),
|
|
36
|
+
takeUntil(this.destroy$)
|
|
37
|
+
)
|
|
38
|
+
.subscribe((results) => {
|
|
39
|
+
this.results = results
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
ngOnDestroy() {
|
|
44
|
+
this.destroy$.next()
|
|
45
|
+
this.destroy$.complete()
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
onSearchChange(searchText: string) {
|
|
49
|
+
if (!searchText) {
|
|
50
|
+
this.clearSearch()
|
|
51
|
+
return
|
|
52
|
+
} else {
|
|
53
|
+
this.searchTextChanged.next(searchText)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
clearSearch() {
|
|
58
|
+
this.searchText = ''
|
|
59
|
+
this.results = []
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
zoomToLocation(result) {
|
|
63
|
+
const map = this.mapManager.map
|
|
64
|
+
const view = map.getView()
|
|
65
|
+
const geometry = result.geom
|
|
66
|
+
|
|
67
|
+
const polygonCoords = geometry.coordinates
|
|
68
|
+
const transformedCoords = polygonCoords[0].map((coord) => fromLonLat(coord))
|
|
69
|
+
|
|
70
|
+
const polygon = new Polygon([transformedCoords])
|
|
71
|
+
|
|
72
|
+
view.fit(polygon, {
|
|
73
|
+
duration: 100,
|
|
74
|
+
maxZoom: 12,
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
onEnterPress() {
|
|
79
|
+
if (this.results && this.results.length > 0) {
|
|
80
|
+
this.zoomToLocation(this.results[0])
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -36,10 +36,14 @@
|
|
|
36
36
|
</div>
|
|
37
37
|
</mat-tab>
|
|
38
38
|
<mat-tab [label]="'map.add.layer.wfs' | translate" bodyClass="h-full">
|
|
39
|
-
<div class="p-3
|
|
39
|
+
<div class="p-3">
|
|
40
|
+
<gn-ui-add-layer-from-wfs></gn-ui-add-layer-from-wfs>
|
|
41
|
+
</div>
|
|
40
42
|
</mat-tab>
|
|
41
43
|
<mat-tab [label]="'map.add.layer.file' | translate" bodyClass="h-full">
|
|
42
|
-
<div class="p-3
|
|
44
|
+
<div class="p-3">
|
|
45
|
+
<gn-ui-add-layer-from-file></gn-ui-add-layer-from-file>
|
|
46
|
+
</div>
|
|
43
47
|
</mat-tab>
|
|
44
48
|
</mat-tab-group>
|
|
45
49
|
</gn-ui-expandable-panel-button>
|
|
@@ -40,6 +40,8 @@ export const DEFAULT_VIEW: MapContextViewModel = {
|
|
|
40
40
|
zoom: 2,
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
export const WFS_MAX_FEATURES = 10000
|
|
44
|
+
|
|
43
45
|
@Injectable({
|
|
44
46
|
providedIn: 'root',
|
|
45
47
|
})
|
|
@@ -111,6 +113,10 @@ export class MapContextService {
|
|
|
111
113
|
urlObj.searchParams.set('typename', layerModel.name)
|
|
112
114
|
urlObj.searchParams.set('srsname', 'EPSG:3857')
|
|
113
115
|
urlObj.searchParams.set('bbox', `${extent.join(',')},EPSG:3857`)
|
|
116
|
+
urlObj.searchParams.set(
|
|
117
|
+
'maxFeatures',
|
|
118
|
+
WFS_MAX_FEATURES.toString()
|
|
119
|
+
)
|
|
114
120
|
return urlObj.toString()
|
|
115
121
|
},
|
|
116
122
|
strategy: bboxStrategy,
|
|
@@ -18,5 +18,7 @@ export * from './lib/pagination/pagination.component'
|
|
|
18
18
|
export * from './lib/related-record-card/related-record-card.component'
|
|
19
19
|
export * from './lib/search-results-error/search-results-error.component'
|
|
20
20
|
export * from './lib/user-preview/user-preview.component'
|
|
21
|
+
export * from './lib/max-lines/max-lines.component'
|
|
21
22
|
export * from './lib/record-api-form/record-api-form.component'
|
|
22
23
|
export * from './lib/markdown-parser/markdown-parser.component'
|
|
24
|
+
export * from './lib/image-overlay-preview/image-overlay-preview.component'
|
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
>
|
|
9
9
|
record.metadata.download
|
|
10
10
|
</p>
|
|
11
|
-
<div
|
|
11
|
+
<div
|
|
12
|
+
class="flex flex-wrap justify-start sm:justify-end sm:pb-4"
|
|
13
|
+
data-cy="download-format-filters"
|
|
14
|
+
>
|
|
12
15
|
<gn-ui-button
|
|
13
16
|
class="m-1 format-filter"
|
|
14
17
|
[extraClass]="
|
package/src/libs/ui/elements/src/lib/image-overlay-preview/image-overlay-preview.component.css
ADDED
|
File without changes
|
package/src/libs/ui/elements/src/lib/image-overlay-preview/image-overlay-preview.component.html
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<gn-ui-content-ghost
|
|
2
|
+
[showContent]="imageUrl !== undefined"
|
|
3
|
+
ghostClass="h-36 mb-3"
|
|
4
|
+
>
|
|
5
|
+
<div
|
|
6
|
+
*ngIf="imageUrl"
|
|
7
|
+
data-cy="record-thumbnail"
|
|
8
|
+
class="flex-shrink-0 bg-gray-100 rounded-lg overflow-hidden w-full border border-gray-300 h-36 group-hover:shadow-xl group-hover:border-0 mb-3"
|
|
9
|
+
>
|
|
10
|
+
<gn-ui-thumbnail
|
|
11
|
+
class="relative h-full w-full"
|
|
12
|
+
[thumbnailUrl]="imageUrl"
|
|
13
|
+
fit="cover"
|
|
14
|
+
(placeholderShown)="isPlaceholderShown.emit($event)"
|
|
15
|
+
></gn-ui-thumbnail>
|
|
16
|
+
<div class="relative">
|
|
17
|
+
<gn-ui-button
|
|
18
|
+
class="absolute bottom-0 right-0 z-10 mr-2 mb-2"
|
|
19
|
+
[type]="'outline'"
|
|
20
|
+
[extraClass]="'!py-2 !px-0'"
|
|
21
|
+
(buttonClick)="openLightbox(imageUrl)"
|
|
22
|
+
>
|
|
23
|
+
<mat-icon class="material-symbols-outlined font-extralight"
|
|
24
|
+
>zoom_out_map</mat-icon
|
|
25
|
+
>
|
|
26
|
+
</gn-ui-button>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</gn-ui-content-ghost>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Component, EventEmitter, Input, Output } from '@angular/core'
|
|
2
|
+
import * as basicLightbox from 'basiclightbox'
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'gn-ui-image-overlay-preview',
|
|
6
|
+
templateUrl: './image-overlay-preview.component.html',
|
|
7
|
+
styleUrls: ['./image-overlay-preview.component.css'],
|
|
8
|
+
})
|
|
9
|
+
export class ImageOverlayPreviewComponent {
|
|
10
|
+
@Input() imageUrl: string
|
|
11
|
+
@Output() isPlaceholderShown = new EventEmitter<boolean>()
|
|
12
|
+
openLightbox(src: string) {
|
|
13
|
+
basicLightbox.create(`<img src="${src}"/>`).show()
|
|
14
|
+
}
|
|
15
|
+
}
|