Skip to content

Commit 31712ad

Browse files
committed
correction du wfs et ajout overlay features
1 parent 1efcb37 commit 31712ad

File tree

7 files changed

+96
-35
lines changed

7 files changed

+96
-35
lines changed

src/app/carte/carte.component.ts

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ import Map from 'ol/Map';
44
import Feature from 'ol/Feature';
55
import { bbox as bboxStrategy } from 'ol/loadingstrategy';
66
import { LayerWFS as GeoportalLayerWFS, LayerMapBox as GeoportalLayerTMS } from "geopf-extensions-openlayers/src";
7+
import { Pixel } from 'ol/pixel';
8+
import {toStringHDMS} from 'ol/coordinate.js';
9+
import {toLonLat} from 'ol/proj.js';
10+
import Overlay from 'ol/Overlay';
11+
import VectorLayer from 'ol/layer/Vector';
12+
import Layer from 'ol/layer/Layer';
713

814
@Component({
915
selector: 'app-carte',
@@ -29,7 +35,7 @@ export class CarteComponent implements OnInit {
2935
style: "simpleadminexpress"
3036
}),
3137
new GeoportalLayerWFS({
32-
layer: "services_publics_test_20250610:carto_sp_interne",
38+
layer: "services_publics_test_20250616:carto_sp_interne",
3339
olParams : {
3440
minZoom: 9,
3541
style: function(feature: Feature){
@@ -43,6 +49,56 @@ export class CarteComponent implements OnInit {
4349
]);
4450

4551
this.map.setTarget(this.elementRef.nativeElement);
46-
}
4752

53+
const overlay = new Overlay({
54+
//@ts-ignore
55+
element: document.getElementById("tooltip-feature"),
56+
autoPan: {
57+
animation: {
58+
duration: 250,
59+
},
60+
},
61+
});
62+
63+
this.map.on('pointermove', function (evt) {
64+
var feature = evt.map.forEachFeatureAtPixel(evt.pixel, function(feature, layer) {
65+
//@ts-ignore
66+
if(layer.name === "services_publics_test_20250616:carto_sp_interne"){
67+
return feature;
68+
}else{
69+
return null;
70+
}
71+
});
72+
73+
if(feature){
74+
const coordinate = evt.coordinate;
75+
//@ts-ignore
76+
if(feature.values_.type_structure == "Permanence"){
77+
//@ts-ignore
78+
document.getElementById("tooltip-feature").innerHTML = '<div>' + feature.values_.permanence_nom + '</div>';
79+
}else{
80+
//@ts-ignore
81+
document.getElementById("tooltip-feature").innerHTML = '<div>' + feature.values_.service_nom + '</div>';
82+
}
83+
84+
overlay.setPosition(coordinate);
85+
overlay.setOffset([10,12]);
86+
87+
//@ts-ignore
88+
document.getElementById("tooltip-feature").style.visibility = 'visible';
89+
evt.map.getTargetElement().style.cursor = 'pointer';
90+
}else{
91+
//@ts-ignore
92+
document.getElementById("tooltip-feature").style.visibility = 'hidden';
93+
evt.map.getTargetElement().style.cursor = '';
94+
}
95+
});
96+
97+
this.map.getTargetElement().addEventListener('pointerleave', function () {
98+
//@ts-ignore
99+
document.getElementById("tooltip-feature").style.visibility = 'hidden';
100+
});
101+
102+
this.map.addOverlay(overlay);
103+
}
48104
}

src/app/controls/layerswitcher/layerswitcher.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class LayerswitcherComponent implements OnInit {
2929
});
3030

3131
this.control.addEventListener("layerswitcher:add", function (e: any) {
32-
if(e.layer.name != undefined && e.target._layers[2] != undefined && e.target._layers[2].name == "services_publics_test_20250610:carto_sp_interne"){
32+
if(e.layer.name != undefined && e.target._layers[2] != undefined && e.target._layers[2].name == "services_publics_test_20250616:carto_sp_interne"){
3333
e.target._lastZIndex++;
3434
e.target._layers[2].layer.values_.zIndex = e.target._lastZIndex;
3535
e.target._updateLayersOrder();

src/app/controls/spwfsfilter/spwfsfilter.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export class SpwfsfilterComponent implements OnInit {
9999
this.control = new WfsFilter({
100100
position: "top-left",
101101
panel: true,
102-
cartospLayerName: "services_publics_test_20250610:carto_sp_interne",
102+
cartospLayerName: "services_publics_test_20250616:carto_sp_interne",
103103
cartospThemesInfo: ThemesInfo
104104
});
105105

src/app/home/home.component.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,12 @@
3838
to {
3939
transform: rotate(359deg);
4040
}
41+
}
42+
43+
#tooltip-feature {
44+
background-color: var(--background-default-grey);
45+
max-width: min(24rem,calc(66.66667vw - 1.33333rem));
46+
padding: 5px;
47+
border-radius: 15px;
48+
border: 2px solid var(--text-action-high-blue-france);
4149
}

src/app/home/home.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<app-scaleline [map]="map"></app-scaleline>
1515
<app-layerselector [map]="map"></app-layerselector>
1616
<app-spselector [map]="map"></app-spselector>
17+
<div id="tooltip-feature"></div>
1718
</div>
1819
<app-rightpanel [map]="map"></app-rightpanel>
1920
}@else {

src/app/rightpanel/content/localisation-info/localisation-info.component.html

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ <h6 class="fr-h6">Données socio-économiques</h6>
4545
<button class="fr-btn--tooltip fr-btn" type="button" id="button-pop" aria-describedby="tooltip-pop">
4646
Source
4747
</button>
48-
<span class="fr-tooltip fr-placement" id="tooltip-pop" role="tooltip" aria-hidden="true">Insee, Recensement de la Population, 2021</span>
48+
<span class="fr-tooltip fr-placement" id="tooltip-pop" role="tooltip" aria-hidden="true">Insee, Recensement de la Population 2021</span>
4949
</div>
5050
<div class="data-value">{{ formatNumber(apidata.population_recensement,'1.0-0') }}</div>
5151
</div>
@@ -68,7 +68,7 @@ <h6 class="fr-h6">Données socio-économiques</h6>
6868
<button class="fr-btn--tooltip fr-btn" type="button" id="button-dens" aria-describedby="tooltip-dens">
6969
Source
7070
</button>
71-
<span class="fr-tooltip fr-placement" id="tooltip-dens" role="tooltip" aria-hidden="true">Insee, Recensement de la Population, 2021</span>
71+
<span class="fr-tooltip fr-placement" id="tooltip-dens" role="tooltip" aria-hidden="true">Nombre d’habitants au km2 <br> Insee, Recensement de la population 2021</span>
7272
</div>
7373
<div class="data-value">{{ formatNumber(apidata.population_densite,'1.1-1') }}</div>
7474
</div>
@@ -91,7 +91,7 @@ <h6 class="fr-h6">Données socio-économiques</h6>
9191
<button class="fr-btn--tooltip fr-btn" type="button" id="button-evopop" aria-describedby="tooltip-evopop">
9292
Source
9393
</button>
94-
<span class="fr-tooltip fr-placement" id="tooltip-evopop" role="tooltip" aria-hidden="true">Insee, Recensement de la Population, 2021</span>
94+
<span class="fr-tooltip fr-placement" id="tooltip-evopop" role="tooltip" aria-hidden="true">Insee, Recensement de la Population 2021</span>
9595
</div>
9696
<div class="data-value">
9797
{{ formatNumber(apidata.population_evolution,'1.2-2') }}@if (apidata.population_evolution){%}
@@ -139,7 +139,7 @@ <h6 class="fr-h6">Données socio-économiques</h6>
139139
<button class="fr-btn--tooltip fr-btn" type="button" id="button-tpv" aria-describedby="tooltip-tpv">
140140
Source
141141
</button>
142-
<span class="fr-tooltip fr-placement" id="tooltip-tpv" role="tooltip" aria-hidden="true">INSEE, FILOSOFI, 2020</span>
142+
<span class="fr-tooltip fr-placement" id="tooltip-tpv" role="tooltip" aria-hidden="true">Part d'individus vivant avec un revenu inférieur à 60% du revenu médian national <br> INSEE, Filosofi 2020</span>
143143
</div>
144144
<div class="data-value">{{ formatNumber(apidata.taux_pauvrete,'1.1-1') }}@if (apidata.taux_pauvrete){%}</div>
145145
</div>
@@ -155,28 +155,24 @@ <h6 class="fr-h6">Données socio-économiques</h6>
155155
</div>
156156
</div>
157157
<!-- Taux de chomage -->
158-
<div class="group-location-info">
159-
<div class="location-info">
160-
<div class="data-title">
161-
Taux de chomage
162-
<button class="fr-btn--tooltip fr-btn" type="button" id="button-chom" aria-describedby="tooltip-chom">
163-
Source
164-
</button>
165-
<span class="fr-tooltip fr-placement" id="tooltip-chom" role="tooltip" aria-hidden="true">Insee, taux de chômage localisés 2023</span>
158+
@if (data.type === "departement"){
159+
<div class="group-location-info">
160+
<div class="location-info">
161+
<div class="data-title">
162+
Taux de chomage
163+
<button class="fr-btn--tooltip fr-btn" type="button" id="button-chom" aria-describedby="tooltip-chom">
164+
Source
165+
</button>
166+
<span class="fr-tooltip fr-placement" id="tooltip-chom" role="tooltip" aria-hidden="true">Taux de chômage au sens du BIT <br> Insee, 2023</span>
167+
</div>
168+
<div class="data-value">{{ formatNumber(apidata.taux_chomage,'1.1-1') }}@if (apidata.taux_chomage){%}</div>
166169
</div>
167-
<div class="data-value">{{ formatNumber(apidata.taux_chomage,'1.1-1') }}@if (apidata.taux_chomage){%}</div>
168-
</div>
169-
<div class="national-info">
170-
<div class="data-title">val. nat.</div>
171-
@if (data.type === "departement"){
170+
<div class="national-info">
171+
<div class="data-title">val. nat.</div>
172172
<div class="data-value">{{ formatNumber(moynat.departement.taux_chomage,'1.1-1') }}@if (moynat.departement.taux_chomage){%}</div>
173-
} @else if (data.type === "epci") {
174-
<div class="data-value">{{ formatNumber(moynat.epci.taux_chomage,'1.1-1') }}@if (moynat.epci.taux_chomage){%}</div>
175-
} @else {
176-
<div class="data-value">{{ formatNumber(moynat.commune.taux_chomage,'1.1-1') }}@if (moynat.commune.taux_chomage){%}</div>
177-
}
173+
</div>
178174
</div>
179-
</div>
175+
}
180176
<!-- Vieillissement -->
181177
<div class="group-location-info">
182178
<div class="location-info">
@@ -185,7 +181,7 @@ <h6 class="fr-h6">Données socio-économiques</h6>
185181
<button class="fr-btn--tooltip fr-btn" type="button" id="button-viei" aria-describedby="tooltip-viei">
186182
Source
187183
</button>
188-
<span class="fr-tooltip fr-placement" id="tooltip-viei" role="tooltip" aria-hidden="true">Insee, Recensement de la Population, 2021</span>
184+
<span class="fr-tooltip fr-placement" id="tooltip-viei" role="tooltip" aria-hidden="true">Rapport de la population des 65 ans et plus sur celle des moins de 20 ans <br> Insee, Recensement de la population 2021</span>
189185
</div>
190186
<div class="data-value">{{ formatNumber(apidata.vieillissement_indice,'1.0-0') }}</div>
191187
</div>

src/assets/customConfig.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"total_sante_nb_kines$GEOPORTAIL:OGC:WMS",
4949
"total_sante_nb_orthophonistes$GEOPORTAIL:OGC:WMS",
5050
"total_sante_nb_sagesfemmes$GEOPORTAIL:OGC:WMS",
51-
"services_publics_test_20250526:poc_v7_5_5$GEOPORTAIL:OGC:WFS",
51+
"services_publics_test_20250616:carto_sp_interne$GEOPORTAIL:OGC:WFS",
5252
"services_publics_test_20250610:carto_sp_interne$GEOPORTAIL:OGC:WFS",
5353
"frequentation_SP_permanences$GEOPORTAIL:OGC:WMS",
5454
"frequentation_SP_v3$GEOPORTAIL:OGC:WMS",
@@ -5600,9 +5600,9 @@
56005600
}
56015601
]
56025602
},
5603-
"services_publics_test_20250610:carto_sp_interne$GEOPORTAIL:OGC:WFS": {
5604-
"name": "services_publics_test_20250610:carto_sp_interne",
5605-
"title": "Services publics jeu test du 10/06/2025",
5603+
"services_publics_test_20250616:carto_sp_interne$GEOPORTAIL:OGC:WFS": {
5604+
"name": "services_publics_test_20250616:carto_sp_interne",
5605+
"title": "Services publics jeu test du 16/06/2025",
56065606
"description": "Ce jeu de données est un jeu de données tests. Il contient les données de services publics sur trois départements pilotes Indre, Nord, Hautes Alpes.",
56075607
"globalConstraint": {
56085608
"minScaleDenominator": 0.0,
@@ -5634,9 +5634,9 @@
56345634
],
56355635
"formats": []
56365636
},
5637-
"services_publics_test_20250526:poc_v7_5_5$GEOPORTAIL:OGC:WFS": {
5638-
"name": "services_publics_test_20250526:poc_v7_5_5",
5639-
"title": "Services publics jeu test du 26/05/2025",
5637+
"services_publics_test_20250610:carto_sp_interne$GEOPORTAIL:OGC:WFS": {
5638+
"name": "services_publics_test_20250610:carto_sp_interne",
5639+
"title": "Services publics jeu test du 10/06/2025",
56405640
"description": "Ce jeu de données est un jeu de données tests. Il contient les données de services publics sur trois départements pilotes Indre, Nord, Hautes Alpes.",
56415641
"globalConstraint": {
56425642
"minScaleDenominator": 0.0,

0 commit comments

Comments
 (0)