diff --git a/proxy.conf.json b/proxy.conf.json index f6d20c2ac69c72bd5ebe74bfd45d949b48ea80c2..6c9d77bee241bf175a367621922204942b09e1ff 100644 --- a/proxy.conf.json +++ b/proxy.conf.json @@ -14,6 +14,12 @@ "changeOrigin": true, "logLevel": "info" }, + "/wfs/grandlyon": { + "target": "https://download.data.grandlyon.com", + "secure": false, + "changeOrigin": true, + "logLevel": "info" + }, "/reverse": { "target": "https://api-adresse.data.gouv.fr", "secure": false, diff --git a/src/app/map/components/map.component.ts b/src/app/map/components/map.component.ts index 81b35c4554b4d6469b45cac011e72f7cb2e83241..330ad40081c7c205a50543af957a194f5d9fa362 100644 --- a/src/app/map/components/map.component.ts +++ b/src/app/map/components/map.component.ts @@ -139,6 +139,8 @@ export class MapComponent implements OnChanges { width: 256, height: 256, }; + // Init mdm + this.initMDMLayer(); // Init WMS service with param from data.grandlyon.com const carteLayer = tileLayer('https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png', { attribution: '© <a href="https://carto.com/attributions">CARTO</a>', @@ -155,6 +157,15 @@ export class MapComponent implements OnChanges { }; } + private initMDMLayer(): void { + this.geoJsonService.getMDMGeoJson().subscribe((res) => { + console.log('test', res); + res.forEach((mdm) => { + this.mapService.createMDMMarker(mdm.geometry.getLon(), mdm.geometry.getLat()).addTo(this.map); + }); + }); + } + /** * Toogle all tooltips given in parameters */ diff --git a/src/app/map/services/map.service.ts b/src/app/map/services/map.service.ts index 822424dace5870c9ea4c7955776d038bc0294777..8227d2a4843a43354d152b67a10cb6e5a5240fea 100644 --- a/src/app/map/services/map.service.ts +++ b/src/app/map/services/map.service.ts @@ -28,6 +28,16 @@ export class MapService { return marker; } + public createMDMMarker(lat: number, lon: number): Marker { + const markerIcon = divIcon({ + className: null, + html: '<svg width="64" height="81"><use xlink:href="assets/ico/sprite.svg#mdm"></use></svg>', + iconSize: [35, 41], + iconAnchor: [13, 41], + }); + return new Marker([lat, lon], { icon: markerIcon }); + } + /** * Toogle a tooltip * @param id marker id diff --git a/src/app/services/geojson.service.ts b/src/app/services/geojson.service.ts index 39aed758f5cf06e5834199bb4bde3df374559153..36c0f3f56210c9b619bfe9df721c5ce01a2496c9 100644 --- a/src/app/services/geojson.service.ts +++ b/src/app/services/geojson.service.ts @@ -4,6 +4,7 @@ import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; import { Address } from '../models/address.model'; import { GeoJson } from '../map/models/geojson.model'; +import * as _ from 'lodash'; @Injectable({ providedIn: 'root', @@ -31,6 +32,27 @@ export class GeojsonService { .pipe(map((data: { features: any[] }) => new GeoJson(data.features[0]))); } + /** + * Parse object to geojosn + * @param data string data + */ + private parseToGeoJson(data: string): GeoJson { + return new GeoJson(data); + } + + /** + * Retrive an address by geolocation + * @param idVoie Number + */ + public getMDMGeoJson(): Observable<GeoJson[]> { + return this.http + .get( + '/wfs/grandlyon' + + '?SERVICE=WFS&VERSION=2.0.0&request=GetFeature&typename=ter_territoire.maison_de_la_metropole&outputFormat=application/json; subtype=geojson&SRSNAME=EPSG:4171&startIndex=0' + ) + .pipe(map((data: { features: any[] }) => _.map(data.features, this.parseToGeoJson))); + } + /** * Get GeoLocation with an address * @param address Address diff --git a/src/assets/ico/MDM.svg b/src/assets/ico/MDM.svg new file mode 100644 index 0000000000000000000000000000000000000000..28a5a32c1e2df2fbf3c79cfc350cbb7fa683f3f8 --- /dev/null +++ b/src/assets/ico/MDM.svg @@ -0,0 +1,14 @@ +<svg width="64" height="81" viewBox="0 0 64 81" fill="none" xmlns="http://www.w3.org/2000/svg"> +<path d="M4.00001 78.0479L4.00001 79.0479H5.00001H27H28V78.0479V62.1437C28 60.4868 29.3432 59.1437 31 59.1437H33C34.6569 59.1437 36 60.4868 36 62.1437V78.0479V79.0479H37H56V79.1437H57H59H60V78.1437L60 27.8479C60 26.1928 58.9807 24.7087 57.4359 24.1145L47.2821 20.2092C46.8824 20.0555 46.5426 19.7775 46.3127 19.4163L46.2589 19.3318L46.1895 19.2597L35.2297 7.87371C33.6783 5.56778 30.2938 5.51412 28.6701 7.76967L16.8041 19.335L16.7323 19.405L16.6759 19.4878C16.4574 19.8082 16.1506 20.0581 15.7927 20.2073L6.46154 24.0952C4.97095 24.7163 4 26.1727 4 27.7875L4.00001 78.0479Z" fill="#F2F2F2" stroke="white" stroke-width="2"/> +<path fill-rule="evenodd" clip-rule="evenodd" d="M5 27.5479C5 26.3368 5.72821 25.2445 6.84615 24.7787L16.4499 20.7771C16.8131 20.6258 17.143 20.4045 17.4207 20.1258L29.8008 7.70625C31.0017 6.50144 32.9632 6.53525 34.1219 7.78072L45.5277 20.0402C45.8385 20.3743 46.2213 20.633 46.6472 20.7968L57.0769 24.8082C58.2355 25.2539 59 26.367 59 27.6083V78.1436L37 78.1437V62.1437C37 59.9345 35.2091 58.1437 33 58.1437H31C28.7909 58.1437 27 59.9345 27 62.1437V78.1437L5 78.1436V27.5479ZM11 60.1437C11 57.9345 12.7909 56.1437 15 56.1437H17C19.2091 56.1437 21 57.9345 21 60.1437V74.1437H11V60.1437ZM43 60.1437C43 57.9345 44.7909 56.1437 47 56.1437H49C51.2091 56.1437 53 57.9345 53 60.1437V74.1437H43V60.1437ZM11 33.9521C11 31.743 12.7909 29.9521 15 29.9521H17C19.2091 29.9521 21 31.743 21 33.9521V47.9521H11V33.9521ZM27 34.0479C27 31.8387 28.7909 30.0479 31 30.0479H33C35.2091 30.0479 37 31.8387 37 34.0479V48.0479H27V34.0479ZM43 34.0479C43 31.8387 44.7909 30.0479 47 30.0479H49C51.2091 30.0479 53 31.8387 53 34.0479V48.0479H43V34.0479ZM32 23C34.2091 23 36 21.2091 36 19C36 16.7909 34.2091 15 32 15C29.7909 15 28 16.7909 28 19C28 21.2091 29.7909 23 32 23Z" fill="#8B999B"/> +<line x1="48" y1="26.0479" x2="48" y2="50.0479" stroke="#8B999B"/> +<line x1="48" y1="52.1437" x2="48" y2="76.1437" stroke="#8B999B"/> +<line x1="32" y1="26.0479" x2="32" y2="50.0479" stroke="#8B999B"/> +<line x1="16" y1="29.9521" x2="16" y2="47.9521" stroke="#8B999B"/> +<line x1="21" y1="39.4521" x2="11" y2="39.4521" stroke="#8B999B"/> +<line x1="21" y1="65.5479" x2="11" y2="65.5479" stroke="#8B999B"/> +<line x1="39" y1="39.5479" x2="23" y2="39.5479" stroke="#8B999B"/> +<line x1="55" y1="39.5479" x2="39" y2="39.5479" stroke="#8B999B"/> +<line x1="55" y1="65.6436" x2="39" y2="65.6436" stroke="#8B999B"/> +<line x1="16" y1="56.0479" x2="16" y2="74.0479" stroke="#8B999B"/> +</svg> diff --git a/src/assets/ico/sprite.svg b/src/assets/ico/sprite.svg index 894e96ef113d8564eb7577b3c88ff1232b47fa0c..65354facc4933eec92ae0fc1788691a53cf5b4e9 100644 --- a/src/assets/ico/sprite.svg +++ b/src/assets/ico/sprite.svg @@ -83,6 +83,22 @@ <path fill-rule="evenodd" clip-rule="evenodd" d="M6.80852 4.27286C6.30371 3.50407 5.45804 3 4.5 3C2.9536 3 1.7 4.3133 1.7 5.93333C1.7 7.00468 2.24824 7.94188 3.06684 8.45382C1.84845 9.02743 1 10.3099 1 11.8V14H5.08296C5.33228 12.514 6.12778 11.214 7.25473 10.3124C6.82705 9.82915 6.49117 9.26223 6.27499 8.63916C6.16478 8.57108 6.05069 8.50916 5.93316 8.45382C6.01417 8.40316 6.09253 8.34834 6.16797 8.28963C6.05843 7.87827 6 7.44599 6 7C6 5.99389 6.29717 5.05718 6.80852 4.27286ZM7.9277 11.055C7.0051 11.7745 6.34145 12.8106 6.10002 14H8V11.8C8 11.5447 7.9751 11.2955 7.9277 11.055ZM7.27499 5.53957C7.29148 5.66836 7.3 5.79981 7.3 5.93333C7.3 6.40316 7.19457 6.84718 7.00713 7.24086C7.0024 7.16118 7 7.08087 7 7C7 6.48461 7.09747 5.99199 7.27499 5.53957Z" fill="#333333"/> </symbol> +<symbol id="mdm" width="64" height="81" viewBox="0 0 64 81" fill="none" xmlns="http://www.w3.org/2000/svg"> +<path d="M4.00001 78.0479L4.00001 79.0479H5.00001H27H28V78.0479V62.1437C28 60.4868 29.3432 59.1437 31 59.1437H33C34.6569 59.1437 36 60.4868 36 62.1437V78.0479V79.0479H37H56V79.1437H57H59H60V78.1437L60 27.8479C60 26.1928 58.9807 24.7087 57.4359 24.1145L47.2821 20.2092C46.8824 20.0555 46.5426 19.7775 46.3127 19.4163L46.2589 19.3318L46.1895 19.2597L35.2297 7.87371C33.6783 5.56778 30.2938 5.51412 28.6701 7.76967L16.8041 19.335L16.7323 19.405L16.6759 19.4878C16.4574 19.8082 16.1506 20.0581 15.7927 20.2073L6.46154 24.0952C4.97095 24.7163 4 26.1727 4 27.7875L4.00001 78.0479Z" fill="#F2F2F2" stroke="white" stroke-width="2"/> +<path fill-rule="evenodd" clip-rule="evenodd" d="M5 27.5479C5 26.3368 5.72821 25.2445 6.84615 24.7787L16.4499 20.7771C16.8131 20.6258 17.143 20.4045 17.4207 20.1258L29.8008 7.70625C31.0017 6.50144 32.9632 6.53525 34.1219 7.78072L45.5277 20.0402C45.8385 20.3743 46.2213 20.633 46.6472 20.7968L57.0769 24.8082C58.2355 25.2539 59 26.367 59 27.6083V78.1436L37 78.1437V62.1437C37 59.9345 35.2091 58.1437 33 58.1437H31C28.7909 58.1437 27 59.9345 27 62.1437V78.1437L5 78.1436V27.5479ZM11 60.1437C11 57.9345 12.7909 56.1437 15 56.1437H17C19.2091 56.1437 21 57.9345 21 60.1437V74.1437H11V60.1437ZM43 60.1437C43 57.9345 44.7909 56.1437 47 56.1437H49C51.2091 56.1437 53 57.9345 53 60.1437V74.1437H43V60.1437ZM11 33.9521C11 31.743 12.7909 29.9521 15 29.9521H17C19.2091 29.9521 21 31.743 21 33.9521V47.9521H11V33.9521ZM27 34.0479C27 31.8387 28.7909 30.0479 31 30.0479H33C35.2091 30.0479 37 31.8387 37 34.0479V48.0479H27V34.0479ZM43 34.0479C43 31.8387 44.7909 30.0479 47 30.0479H49C51.2091 30.0479 53 31.8387 53 34.0479V48.0479H43V34.0479ZM32 23C34.2091 23 36 21.2091 36 19C36 16.7909 34.2091 15 32 15C29.7909 15 28 16.7909 28 19C28 21.2091 29.7909 23 32 23Z" fill="#8B999B"/> +<line x1="48" y1="26.0479" x2="48" y2="50.0479" stroke="#8B999B"/> +<line x1="48" y1="52.1437" x2="48" y2="76.1437" stroke="#8B999B"/> +<line x1="32" y1="26.0479" x2="32" y2="50.0479" stroke="#8B999B"/> +<line x1="16" y1="29.9521" x2="16" y2="47.9521" stroke="#8B999B"/> +<line x1="21" y1="39.4521" x2="11" y2="39.4521" stroke="#8B999B"/> +<line x1="21" y1="65.5479" x2="11" y2="65.5479" stroke="#8B999B"/> +<line x1="39" y1="39.5479" x2="23" y2="39.5479" stroke="#8B999B"/> +<line x1="55" y1="39.5479" x2="39" y2="39.5479" stroke="#8B999B"/> +<line x1="55" y1="65.6436" x2="39" y2="65.6436" stroke="#8B999B"/> +<line x1="16" y1="56.0479" x2="16" y2="74.0479" stroke="#8B999B"/> +</symbol> + + <symbol id="wifi" width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/symbol"> <g clip-path="url(#clip0)"> <path d="M1.08488 8.63175C3.61838 6.09825 7.11838 4.53125 10.9844 4.53125C14.8504 4.53125 18.3504 6.09825 20.8839 8.63175L19.4697 10.046C17.2981 7.87439 14.2981 6.53125 10.9844 6.53125C7.67067 6.53125 4.67067 7.8744 2.4991 10.046L1.08488 8.63175Z" fill="#333333"/>